Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes #284 trailing slash setting is taken into account

  • Loading branch information...
commit 41aa54d1163a207fb89b97e0b33c34509672e768 1 parent 31ff505
@digi604 digi604 authored
Showing with 15 additions and 2 deletions.
  1. +9 −1 cms/appresolver.py
  2. +6 −1 cms/urls.py
View
10 cms/appresolver.py
@@ -35,6 +35,7 @@ def resolve_page_id(self, path):
assigned.
"""
tried = []
+ print path
match = self.regex.search(path)
if match:
new_path = path[match.end():]
@@ -53,6 +54,8 @@ def resolve_page_id(self, path):
else:
return self.page_id
tried.append(pattern.regex.pattern)
+ print tried
+ print new_path
raise Resolver404, {'tried': tried, 'path': new_path}
@@ -101,7 +104,7 @@ def __init__(self, path, title, default_kwargs={}):
if settings.APPEND_SLASH:
regex += r'/'
urlconf_name = title.application_urls
-
+ print regex
# assign page_id to resolver, so he knows on which page he was assigned
self.page_id = title.page_id
super(ApplicationRegexUrlResolver, self).__init__(regex, urlconf_name, default_kwargs)
@@ -166,11 +169,16 @@ def urlpatterns(self):
else:
path = title.path
mixid = "%s:%s" % (path + "/", title.application_urls)
+ print path
+ print mixid
if mixid in included:
# don't add the same thing twice
continue
+ if not settings.APPEND_SLASH:
+ path += '/'
urls.append(ApplicationRegexUrlResolver(path, title))
included.append(mixid)
+ print urls
self._urlpatterns = urls
return self._urlpatterns
View
7 cms/urls.py
@@ -2,10 +2,15 @@
from django.conf import settings
from cms.views import details
+if settings.APPEND_SLASH:
+ reg = url(r'^(?P<slug>[0-9A-Za-z-_.//]+)/$', details, name='pages-details-by-slug')
+else:
+ reg = url(r'^(?P<slug>[0-9A-Za-z-_.//]+)$', details, name='pages-details-by-slug')
+
urlpatterns = (
# Public pages
url(r'^$', details, {'slug':''}, name='pages-root'),
- url(r'^(?P<slug>[0-9A-Za-z-_.//]+)/$', details, name='pages-details-by-slug'),
+ reg,
)
if settings.CMS_APPLICATIONS_URLS:
Please sign in to comment.
Something went wrong with that request. Please try again.