From 6148dda72f47e40754fc2eb75d86274fb68f2d41 Mon Sep 17 00:00:00 2001 From: Jirka Vejrazka Date: Wed, 4 Apr 2018 20:03:16 +0200 Subject: Fixed #29288 -- Made {% widthratio %} assign to as var if an exception occurs. --- django/template/defaulttags.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'django') diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 6e52249584..43c557f179 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -483,9 +483,9 @@ class WidthRatioNode(Node): ratio = (value / max_value) * max_width result = str(round(ratio)) except ZeroDivisionError: - return '0' + result = '0' except (ValueError, TypeError, OverflowError): - return '' + result = '' if self.asvar: context[self.asvar] = result -- cgit v1.3