Created function to translate between sledrun title names and urls.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Tue, 2 Feb 2016 21:08:32 +0000 (21:08 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Tue, 2 Feb 2016 21:08:32 +0000 (21:08 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@2426 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrpylib/wrvalidators.py

index 468cb714df00021f2bb72a6f36500796543c2777..d3114550dd9a67d12c01b94241e06c004d703066 100644 (file)
@@ -842,3 +842,9 @@ class GasthausboxDictValidator(OrderedSchema):
         self.add_field('Telefon', PhoneCommentListNeinLoopNone(comments_are_optional=True))
         self.add_field('Bild', UnicodeNone())
         self.add_field('Rodelbahnen', WikiPageListLoopNone())
+
+
+def sledrun_page_title_to_pretty_url(page_title):
+    """Converts a page_title from the page_title column of wrsledruncache to name_url.
+    name_url is not used by MediaWiki but by new applications like wrweb."""
+    return page_title.lower().replace(' ', '-').replace('_', '-').replace('(', '').replace(')', '')