Opened 3 years ago

Closed 3 years ago

#18739 closed Bug (fixed)

{% widthratio %} fails on sql NULL objects

Reported by: ja.geb@… Owned by: nobody
Component: Template system Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: no UI/UX: no

Description

widthratio is throwing TypeError exception when feeded with sql NULL, python NoneType? data.

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/var/www/gamebee.de/django/comparison/views.py", line 55, in detail
   context_instance=RequestContext(request))

 File "/usr/local/lib/python2.7/dist-packages/django/shortcuts/__init__.py", line 20, in render_to_response
   return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)

 File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", line 176, in render_to_string
   return t.render(context_instance)

 File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 140, in render
   return self._render(context)

 File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 134, in _render
   return self.nodelist.render(context)

 File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 823, in render
   bit = self.render_node(node, context)

 File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 837, in render_node
   return node.render(context)

 File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 123, in render
   return compiled_parent._render(context)

 File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 134, in _render
   return self.nodelist.render(context)

 File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 823, in render
   bit = self.render_node(node, context)

 File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 837, in render_node
   return node.render(context)

 File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 62, in render
   result = block.nodelist.render(context)

 File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 823, in render
   bit = self.render_node(node, context)

 File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 837, in render_node
   return node.render(context)

 File "/usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py", line 451, in render
   value = float(value)

TypeError: float() argument must be a string or a number}}}

Change History (1)

comment:1 Changed 3 years ago by Karen Tracey <kmtracey@…>

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

In [759ae3c2dafe149485a15d9a3bc97527c1ac1163]:

Fixed #18739 -- witdthratio behavior on None args

Made behavior given None consistent with how non-numerics were handled.
Thanks to ja.geb@… for the report.

Note: See TracTickets for help on using tickets.
Back to Top