Ticket #539: efficient_slice.patch
File efficient_slice.patch, 877 bytes (added by , 19 years ago) |
---|
-
django/core/defaultfilters.py
245 245 for an introduction. 246 246 """ 247 247 try: 248 start, finish = arg.split(':') 249 except ValueError: # unpack list of wrong size 250 return value # fail silently but nicely 251 try: 252 if start and finish: 253 return value[int(start):int(finish)] 254 if start: 255 return value[int(start):] 256 if finish: 257 return value[:int(finish)] 248 return value[slice(*[x and int(x) or None for x in arg.split(':')])] 249 except ValueError: 250 pass 258 251 except TypeError: 259 252 pass 260 return value 253 return value # fail silently but nicely 261 254 262 255 def unordered_list(value, _): 263 256 """