My thoughts: On Thu, Aug 23, 2012 at 3:17 PM, Klaas van Schelven < [email protected]> wrote: > > However, this fails, since the regular template variable resolution > process is reused to resolve 'link'. Since link is a callable Django > will attempt to call it. However, 'other_view' shouldn't really be > called (rather, it should be used as the input of a call to reverse). >
This is the expected behaviour. The documentation should probably be updated to clarify the sentence "This will allow the url<https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#std:templatetag-url> tag to use a context variable as the value of the URL name to be reversed." as below. > > I see the following 2 logical courses of action and a possible extra: > 1] the status quo is the desired behavior: improve the documentation > +1: something like "The first parameter of the url<https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#std:templatetag-url> tag will become a context variable. If a callable is passed, it will be called and the return value used to be resolved into a URL, following the standard template variable resolution system." maybe? > 2] allow for passing callables. However, this also makes certain use > cases impossible. I.e. > -1 on this. This smells too much like magic to me, and it makes it incredibly unclear what you're actually going to output. > extra] don't silently continue when the url's first param fails to > evaluate properly only to fail 3 lines later with an incomprehensible > error message. > That smells like it should be filed as a bug to me. Regards, Luke Granger-Brown -- 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.
