On 4/10/07, Martin J Hsu <[EMAIL PROTECTED]> wrote:
>
> On Apr 10, 12:26 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> wrote:
> > What you are proposing would complicate the convenience mechanism of
> > allowing simple callables in extra_context, in the name of duplicating
> > functionality that is already possible by defining a context
> > processor. Why is this a desirable change?
>
> I'm sorry, but I don't see how this complicates anything.  Nobody is
> forced to change their current or future code.  Unless I'm missing
> something, it is 100% backward compatible w/ the way things are now.
> There is a little bit of extra overhead should the callable not be
> defined w/ the request variable and an exception thrown and the
> callable is dispatched w/o an argument.

It complicates the implementation, and, as you noted, slows down
slightly for all existing use cases of a callable.

This isn't a problem in and of itself, except that the only benefit
you get for the complexity and slowdown is the ability to use
'extra_context' instead of 'context_processor' in your generic view
declaration. I don't see this as benefit at all.

> In addition, people who use the book as a guide, will be introduced to
> generic_views and then might need to expand their utility.  Thus, it
> might not be strange for them to come upon the docs that explain the
> 'extra_context' parameter.  Maybe they would think, 'hmm, this is
> convenient, but it would be nice to have the request.  I guess I'll
> ask the mailing list how this can be done.'  This is precisely how I
> started looking at this.

At which point we say "Use a context processor. You can define and use
a context processor for a single generic view; if you find you're
using one particular context processor a lot, consider adding it to
TEMPLATE_CONTEXT_PROCESSORS". It's easy to explain, and it provides a
neat excuse for introducing the idea of context processors, which have
uses outside the world of generic views.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to