Ticket #2276: defaultfilters.py.3.diff
File defaultfilters.py.3.diff, 740 bytes (added by , 18 years ago) |
---|
-
django/template/defaultfilters.py
65 65 66 66 def slugify(value): 67 67 "Converts to lowercase, removes non-alpha chars and converts spaces to hyphens" 68 value = re.sub('[^\w\s-]', '', value).strip().lower() 69 return re.sub('[-\s]+', '-', value) 68 decoded_value = unicode(value, 'utf-8') 69 p = re.compile('[^\w\s-]', re.UNICODE) 70 decoded_value = re.sub(p, '', decoded_value).strip().lower() 71 decoded_value = re.sub('[-\s]+', '-', decoded_value) 72 return decoded_value.encode('utf-8') 70 73 71 74 def stringformat(value, arg): 72 75 """