summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-12-28 14:35:51 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-12-28 14:35:51 -0300
commit325251c0b3274d638c95fec82d84268432273df8 (patch)
tree2c17e849129b6364a42fc476a83e3d0bb9b5fd22
parenteea49803aa48f8f2bf10d48f44ccc238b10c367f (diff)
downloadaskbot-325251c0b3274d638c95fec82d84268432273df8.tar.gz
askbot-325251c0b3274d638c95fec82d84268432273df8.tar.bz2
askbot-325251c0b3274d638c95fec82d84268432273df8.zip
added basic slugification to titles when ALLOW_UNICODE_SLUGS = True
-rw-r--r--askbot/doc/source/changelog.rst5
-rw-r--r--askbot/utils/slug.py4
2 files changed, 7 insertions, 2 deletions
diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst
index a0bcb20e..d69f4504 100644
--- a/askbot/doc/source/changelog.rst
+++ b/askbot/doc/source/changelog.rst
@@ -1,6 +1,11 @@
Changes in Askbot
=================
+Development version (not released yet)
+--------------------------------------
+* added basic slugification treatment to question titles with
+ ``ALLOW_UNICODE_SLUGS = True`` (Evgeny)
+
0.7.36 (Dec 20, 2011)
---------------------
* bugfix and made the logo not used by default
diff --git a/askbot/utils/slug.py b/askbot/utils/slug.py
index dbf794ce..1c8010c8 100644
--- a/askbot/utils/slug.py
+++ b/askbot/utils/slug.py
@@ -8,7 +8,7 @@ slug will be simply equal to the input text
from unidecode import unidecode
from django.template import defaultfilters
from django.conf import settings
-
+import re
def slugify(input_text, max_length=50):
"""custom slugify function that
@@ -30,4 +30,4 @@ def slugify(input_text, max_length=50):
break
return slug
else:
- return input_text
+ return re.sub(r'\s+', '-', input_text.strip().lower())