On Sat, Feb 25, 2017 at 2:10 PM, Tim Graham <[email protected]> wrote:

> I think any use of undefined template variables should raise an exception.
> In the long run, keeping a setting to allow some other behavior seems
> confusing and, considering the case of templates that might be reused in
> different projects with different settings, even dangerous.
>

I think I'm confused...Django templates have allowed use of undefined
variables and documented their use as evaluating to the empty string for as
long as I recall. Wouldn't a change to instead raise exceptions be a major
backwards-incompatibility?

https://docs.djangoproject.com/en/1.7/topics/templates/#variables said "If
you use a variable that doesn’t exist, the template system will insert the
value of the TEMPLATE_STRING_IF_INVALID setting, which is set to '' (the
empty string) by default."

https://docs.djangoproject.com/en/dev/ref/templates/api/#invalid-template-variables
has refined that doc to note that the behavior is slightly different in
some tags.

Are we really considering changing this behavior to now raise exceptions?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CACS9rad-TtehoMxLCruRv5M8yT_GHH-nZxvBETcVaRrLfHVkUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to