Opened 18 years ago
Closed 18 years ago
#3465 closed (fixed)
template variable list-index lookup on an unsubscriptable object raises TypeError
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
For example, if the template variable "foobar
" with value of None is passed to a template that uses:
{{ foobar.13 }}
The following traceback is produced
Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/django/template/__init__.py" in render_node 718. result = node.render(context) File "/usr/lib/python2.4/site-packages/django/template/__init__.py" in render 768. output = self.filter_expression.resolve(context) File "/usr/lib/python2.4/site-packages/django/template/__init__.py" in resolve 561. obj = resolve_variable(self.var, context) File "/usr/lib/python2.4/site-packages/django/template/__init__.py" in resolve_variable 667. current = current[int(bits[0])] TypeError at /it/ unsubscriptable object
The expected result would be for {{ foobar.13 }}
to fail silently.
Attachments (2)
Change History (4)
by , 18 years ago
by , 18 years ago
Attachment: | 3465_2.diff added |
---|
fixed a couple of spelling errors and added comments to one of the tests
comment:1 by , 18 years ago
Has patch: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
I'll let someone else review and mark as ready for checkin.
comment:2 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
a patch with some regression tests