For example, you miss Http404 and other error responses, which are
implemented as exceptional control flow. In addition, you can't do any
preprocessing of the request; for example, you can't set up any invariants
before your actual view method is called.

Best,
Alex Ogier


On Wed, Nov 14, 2012 at 8:48 AM, Daniel Sokolowski <
[email protected]> wrote:

>   Can you elaborate the nasty side effects you are thinking of? I can’t
> think of any that that the base views do to warrant your statement.
>
>  *From:* Aaron Merriam <[email protected]>
>  *Sent:* Friday, November 09, 2012 3:12 PM
> *To:* [email protected]
> *Subject:* Re: Class based views: A standard hook for
> http-method-independent code
>
> That pattern has nasty side-effects.  It can be used in some cases but it
> fails in most.
>
> On Friday, November 9, 2012 8:28:47 AM UTC-7, Daniel Sokolowski wrote:
>>
>>   I’ve done the below in the past, the only issue with that is if you
>> have side effects in parent’s dispatch you don’t want executed but you
>> would also run that risk if you had an initialize() method work flow; in
>> the end I find dispatch() is enough in my experience.
>>
>> def dispatch(self, request, *args, **kwargs):
>>     parent_dispatch_return = super(Class, self).dispatch(request, *args,
>> **kwargs)
>>     ...my code based on values based on the super call...
>>     return parent_dispatch_return
>>
>

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

Reply via email to