On Wed, Apr 25, 2012 at 5:50 PM, Marcin Tustin <marcin.tus...@gmail.com> wrote:
> Just because you used to do it in Struts, it does not mean that it is the
> best, or even a good, way to do it in django.
>

That's not true, certainly not in this case. A commonly used feature
in Django is the ability to add view decorators to a view. These can
intercept the request before calling the view function, modify the
request, call a different function, modify the response returned, etc.
A single view function can be decorated by many decorators, each
calling the next in a middleware-like chain.

In fact, middleware is so analogous with decorators that there is an
adaptor function that ships with django that turns a middleware class
into a decorator that can be applied to a single view - I think it is
called 'decorator_from_middleware'.

Given that, I would say that view decorators are Django's equivalent
of per view middleware.

In the world of web development, there is little that is new and
revolutionary, simply because they all solve similar goals. A piece of
technology in one framework is likely to inspire similar features in
another framework.

What one framework may call something may not be what another
framework does, and users moving between frameworks don't need to be
belittled just because they do not know how that framework names
things.

Cheers

Tom

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

Reply via email to