mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #21959 -- Handled Inf/NaN in widthratio tag.
Thanks rmoe for the report and the patch.
This commit is contained in:
		| @@ -498,11 +498,11 @@ class WidthRatioNode(Node): | ||||
|             value = float(value) | ||||
|             max_value = float(max_value) | ||||
|             ratio = (value / max_value) * max_width | ||||
|             result = str(int(round(ratio))) | ||||
|         except ZeroDivisionError: | ||||
|             return '0' | ||||
|         except (ValueError, TypeError): | ||||
|         except (ValueError, TypeError, OverflowError): | ||||
|             return '' | ||||
|         result = str(int(round(ratio))) | ||||
|  | ||||
|         if self.asvar: | ||||
|             context[self.asvar] = result | ||||
|   | ||||
		Reference in New Issue
	
	Block a user