Ticket #2276: defaultfilters.py.2.diff
File defaultfilters.py.2.diff, 606 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() 68 value = unicode(value, 'utf-8') 69 p = re.compile('[^\w\s-]', re.UNICODE) 70 value = re.sub(p, '', value).strip().lower() 69 71 return re.sub('[-\s]+', '-', value) 70 72 71 73 def stringformat(value, arg):