On Wednesday 02 June 2010 16:08:24 Roald wrote:
> Maybe I've missed the reason, or it's just too late to change, but
> why not using a class itself (so basically its __init__ method) as
> a view. I'm using something like this in my projects (as a base
> class):
> 
>     class View(HttpRequest):
>         def __init__(self, request, *args, **kwargs):
>             ...
>             super(View, self).__init__(self.content())
>         ...
> 

You mean:

     class View(HttpResponse):
         ...

One reason against this is it makes it harder to re-use other views 
from within the View.  You are forced to mutate the 'self' instance of 
HttpResponse (or else use some nasty hack), rather than being able to 
simply return the HttpResponse that might be returned from a utility 
function or a sub-view.

Luke

-- 
"Oh, look. I appear to be lying at the bottom of a very deep, dark 
hole. That seems a familiar concept. What does it remind me of? Ah, 
I remember. Life."  (Marvin the paranoid android)

Luke Plant || http://lukeplant.me.uk/

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to