Ticket #8462: length_invalid_usage_8462.diff
File length_invalid_usage_8462.diff, 761 bytes (added by , 16 years ago) |
---|
-
django/template/defaultfilters.py
507 507 508 508 def length(value): 509 509 """Returns the length of the value - useful for lists.""" 510 return len(value) 510 try: 511 return len(value) 512 except (ValueError,TypeError): 513 return '' 511 514 length.is_safe = True 512 515 513 516 def length_is(value, arg): 514 517 """Returns a boolean of whether the value's length is the argument.""" 515 return len(value) == int(arg) 518 try: 519 return len(value) == int(arg) 520 except (ValueError,TypeError): 521 return '' 516 522 length_is.is_safe = False 517 523 518 524 def random(value):