summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pelican/tests/test_contents.py2
-rw-r--r--pelican/urlwrappers.py2
-rw-r--r--pelican/utils.py2
3 files changed, 4 insertions, 2 deletions
diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py
index e64b3804..e880f079 100644
--- a/pelican/tests/test_contents.py
+++ b/pelican/tests/test_contents.py
@@ -388,7 +388,7 @@ class TestArticle(TestPage):
def test_slugify_category_author(self):
settings = get_settings()
- settings['SLUG_SUBSTITUTIONS'] = [ ('C#', 'csharp') ]
+ settings['SLUG_SUBSTITUTIONS'] = (('C#', 'csharp'),)
settings['ARTICLE_URL'] = '{author}/{category}/{slug}/'
settings['ARTICLE_SAVE_AS'] = '{author}/{category}/{slug}/index.html'
article_kwargs = self._copy_page_kwargs()
diff --git a/pelican/urlwrappers.py b/pelican/urlwrappers.py
index f92d1963..7b957532 100644
--- a/pelican/urlwrappers.py
+++ b/pelican/urlwrappers.py
@@ -41,6 +41,8 @@ class URLWrapper(object):
return self.slug
def _normalize_key(self, key):
+ if hasattr(key, 'name'):
+ key = key.name
subs = self.settings.get('SLUG_SUBSTITUTIONS', ())
return six.text_type(slugify(key, subs))
diff --git a/pelican/utils.py b/pelican/utils.py
index 1f8cb0a6..6286cfd2 100644
--- a/pelican/utils.py
+++ b/pelican/utils.py
@@ -239,7 +239,7 @@ def pelican_open(filename):
content = content[1:]
yield content
-
+@memoized
def slugify(value, substitutions=()):
"""
Normalizes string, converts to lowercase, removes non-alpha characters,