Skip to content
Browse files

FIX: bug where superfluous slash was added to urls reversed from apph…

…ooks at root level.

Commit pulled from django-cms devleopment branch from @piquadrat
  • Loading branch information...
1 parent f143207 commit 087aeac2e5040e3d126a12f97fb7eb84180c6474 @powellc committed Jul 26, 2012
Showing with 15 additions and 2 deletions.
  1. +1 −1 cms/appresolver.py
  2. +14 −1 cms/tests/apphooks.py
View
2 cms/appresolver.py
@@ -124,7 +124,7 @@ def get_patterns_for_title(path, title):
app = apphook_pool.get_apphook(title.application_urls)
patterns = []
for pattern_list in get_app_urls(app.urls):
- if not path.endswith('/'):
+ if path and not path.endswith('/'):
path += '/'
page_id = title.page.id
patterns += recurse_patterns(path, pattern_list, page_id)
View
15 cms/tests/apphooks.py
@@ -84,7 +84,20 @@ def test_apphook_on_root(self):
self.assertTemplateUsed(response, 'nav_playground.html')
apphook_pool.clear()
-
+
+ def test_apphook_on_root_reverse(self):
+ with SettingsOverride(ROOT_URLCONF='cms.test_utils.project.urls_for_apphook_tests'):
+ apphook_pool.clear()
+ superuser = User.objects.create_superuser('admin', 'admin@admin.com', 'admin')
+ page = create_page("apphooked-page", "nav_playground.html", "en",
+ created_by=superuser, published=True, apphook="SampleApp")
+ create_title("de", "aphooked-page-de", page, apphook="SampleApp")
+ self.assertTrue(page.publish())
+
+ self.assertFalse(reverse('sample-settings').startswith('//'))
+
+ apphook_pool.clear()
+
def test_get_page_for_apphook(self):
with SettingsOverride(ROOT_URLCONF='cms.test_utils.project.second_urls_for_apphook_tests'):

0 comments on commit 087aeac

Please sign in to comment.
Something went wrong with that request. Please try again.