diff --git a/horizon/templatetags/sizeformat.py b/horizon/templatetags/sizeformat.py index 06e00c628e..0068f6e34a 100644 --- a/horizon/templatetags/sizeformat.py +++ b/horizon/templatetags/sizeformat.py @@ -51,6 +51,8 @@ def filesizeformat(bytes, filesize_number_format): return ungettext_lazy("%(size)d Byte", "%(size)d Bytes", 0) % {'size': 0} + if bytes == float('inf'): + return _('Infinity') if bytes < units.Ki: bytes = int(bytes) return ungettext_lazy("%(size)d Byte", @@ -63,7 +65,13 @@ def filesizeformat(bytes, filesize_number_format): return _("%s GB") % filesize_number_format(bytes / units.Gi) if bytes < units.Pi: return _("%s TB") % filesize_number_format(bytes / units.Ti) - return _("%s PB") % filesize_number_format(bytes / units.Pi) + if bytes < units.Ei: + return _("%s PB") % filesize_number_format(bytes / units.Pi) + if bytes < units.Zi: + return _("%s EB") % filesize_number_format(bytes / units.Ei) + if bytes < units.Yi: + return _("%s ZB") % filesize_number_format(bytes / units.Zi) + return _("%s YB") % filesize_number_format(bytes / units.Yi) def float_cast_filesizeformat(value, multiplier=1, format=int_format):