#22767: Unexpected value for an unset variable with length filter in templates
---------------------------------+--------------------------------------
Reporter: Walkman | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Comment (by gchp):
Saying that, I would still expect the `length` filter to return `0` unless
the length is indeed something other than that. From taking a quick look,
it seems to return an empty string if the value given does not support
`len()`. I changed this to instead return `0` and it does indeed fix the
issue, though it makes a ton of tests fail. Perhaps someone with a little
more experience with filters can provide some insight as to why it
currently returns a string?
--
Ticket URL: <https://code.djangoproject.com/ticket/22767#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.5d4df63a7c569a046a2fc8a119ae2086%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.