]> git.openstreetmap.org Git - osqa.git/blob - forum/utils/djangofix.py
Access request trough singleton where necessarry
[osqa.git] / forum / utils / djangofix.py
1 import re
2 import urllib
3 from forum.modules import decorate
4
5 from django.template.defaultfilters import slugify
6 from django.utils.safestring import mark_safe
7 from django.utils.http import urlquote_plus
8
9 slug_re = re.compile(r'\w+', re.UNICODE)
10
11 @decorate(slugify)
12 def imp_slugify(origin, value):
13     if settings.ALLOW_UNICODE_IN_SLUGS:
14         try:
15             bits = slug_re.findall(value.lower())
16             return mark_safe("-".join(bits))
17         except:
18             pass
19     return origin(value)
20
21 from forum import settings