wiki: Move space replace into normalize.

This commit is contained in:
Andre D
2012-12-12 15:09:22 -05:00
committed by Neil Williams
parent 2bda185248
commit a225d34a6f

View File

@@ -172,6 +172,9 @@ def normalize_page(page):
# Ensure there is no side effect if page is None
page = page or ""
# Replace spaces with underscores
page = page.replace(' ', '_')
# Case insensitive page names
page = page.lower()
@@ -206,14 +209,11 @@ class VWikiPageName(Validator):
except UnicodeEncodeError:
return self.set_error('INVALID_PAGE_NAME', code=400)
if ' ' in page:
page = page.replace(' ', '_')
page = normalize_page(page)
if page and not page_match_regex.match(page):
return self.set_error('INVALID_PAGE_NAME', code=400)
page = normalize_page(page)
# If no page is specified, give the index page
page = page or "index"