Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#10552 closed (duplicate)

Built-in template fails "lowdly" with exception

Reported by: powerfox Owned by: nobody
Component: Template system Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

length_is filter causes an exception if it's used with None intead of something that has len() method. According to docs this should never happen (tags and filters fails silently).

Exception Value:  	

Caught an exception while rendering: object of type 'NoneType' has no len()

Original Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/django/template/debug.py", line 71, in render_node
    result = node.render(context)
  File "/usr/local/lib/python2.5/site-packages/django/template/defaulttags.py", line 250, in render
    value = bool_expr.resolve(context, True)
  File "/usr/local/lib/python2.5/site-packages/django/template/__init__.py", line 559, in resolve
    new_obj = func(obj, *arg_vals)
  File "/usr/local/lib/python2.5/site-packages/django/template/defaultfilters.py", line 523, in length_is
    return len(value) == int(arg)
TypeError: object of type 'NoneType' has no len()

Attachments (0)

Change History (3)

comment:1 Changed 5 years ago by jacob

  • milestone set to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by ramiro

  • Resolution set to duplicate
  • Status changed from new to closed

This is a dupe of #8462 and was fixed in r10193/r10194

comment:3 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.