>
> As an example of what I'm talking about -- #14262 is a manifestation
> of a use case that is undeniably simple: "get_function() as var". This
> pattern is used in several places in Django's own codebase.


<snip>

 To that end, I'm willing to be practical and concede that adding takes_context
> would at the very least be consistent, even if it still fails to hit a
> large range of test cases.


Forgive me if this proposal has already been turned down, but what about the
following:

We give takes_context to the simple_tag shortcut, for consistency.  Then a
new shortcut, assignment_tag is added such as

@register.assignment_tag
def get_foobars():
   // do work
   return results

Then, within the template, the user simply calls `get_foobars as coconuts`,
`results` gets assigned to `coconuts` within the context.

There is also the broader (and completely nebulous)
> proposal regarding making tag parsers easier to write. That's a *much*
> bigger can of worms.


Personally, I don't think writing a template tag is _too hard_.  I think
it's overkill for the simple tasks, namely assigning content to a variable.
 If we had a shortcut to do that, anything beyond that could be done as a
regular custom tag.

(sorry if this was formatted horribly, I was battling with gmail here).

-- 
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