Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

`kotti.util.title_to_name` will now return a name with a maximum

length of 40.  Fixes #31.
  • Loading branch information...
commit 7eabc6a5a00a27262a50726a7bc8ce7777b605d5 1 parent b01cc86
@dnouri authored
Showing with 12 additions and 1 deletion.
  1. +3 −0  CHANGES.txt
  2. +8 −0 kotti/tests/test_util.py
  3. +1 −1  kotti/util.py
View
3  CHANGES.txt
@@ -6,6 +6,9 @@ Change History
- Make the 'item_type' attribute of AddForm optional. Fixes #41.
+- `kotti.util.title_to_name` will now return a name with a maximum
+ length of 40. Fixes #31.
+
0.6.0b1 - 2012-03-15
--------------------
View
8 kotti/tests/test_util.py
@@ -129,9 +129,17 @@ def my_fun(a, b):
my_fun(1, 2)
self.assertEqual(len(called), 2)
+
class TestLRUCache(TestRequestCache):
def setUp(self):
from kotti.util import lru_cache
super(TestLRUCache, self).setUp()
self.cache_decorator = lru_cache
+
+
+class TestTitleToName(TestCase):
+ def test_max_length(self):
+ from kotti.util import title_to_name
+
+ assert len(title_to_name(u'a' * 50)) == 40
View
2  kotti/util.py
@@ -233,4 +233,4 @@ def title_to_name(title):
locale_name = get_locale_name(request)
else:
locale_name = 'en'
- return unicode(urlnormalizer.normalize(title, locale_name))
+ return unicode(urlnormalizer.normalize(title, locale_name, max_length=40))
Please sign in to comment.
Something went wrong with that request. Please try again.