Ticket #2914: 2914.diff
File 2914.diff, 589 bytes (added by , 18 years ago) |
---|
-
django/template/defaultfilters.py
421 421 Format the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 422 422 bytes, etc). 423 423 """ 424 bytes = float(bytes) 424 try: 425 bytes = float(bytes) 426 except TypeError: 427 return "0 bytes" 428 425 429 if bytes < 1024: 426 430 return "%d byte%s" % (bytes, bytes != 1 and 's' or '') 427 431 if bytes < 1024 * 1024: