Skip to content
This repository
Browse code

Merge pull request #935 from ojii/failfast-on-invalid-menu-usage

When using the menu tag wrong (eg give a page as 'namespace') the menu ta
  • Loading branch information...
commit 16086e19e5af1af699030942e283ff5ee553f6ef 2 parents e22acbd + 68a5390
Øyvind Saltvik authored August 14, 2011
10  cms/tests/menu.py
@@ -13,7 +13,7 @@
13 13
 from django.contrib.auth.models import AnonymousUser, User, Permission, Group
14 14
 from django.contrib.contenttypes.models import ContentType
15 15
 from django.contrib.sites.models import Site
16  
-from django.template import Template
  16
+from django.template import Template, TemplateSyntaxError
17 17
 from menus.base import NavigationNode
18 18
 from menus.menu_pool import menu_pool, _build_nodes_inner_for_one_menu
19 19
 from menus.utils import mark_descendants, find_selected, cut_levels
@@ -71,6 +71,14 @@ def get_level(self, num):
71 71
     def get_all_pages(self):
72 72
         return Page.objects.all()
73 73
     
  74
+    def test_menu_failfast_on_invalid_usage(self):
  75
+        context = self.get_context()
  76
+        context['child'] = self.get_page(1)
  77
+        # test standard show_menu
  78
+        with SettingsOverride(DEBUG=True, TEMPLATE_DEBUG=True):
  79
+            tpl = Template("{% load menu_tags %}{% show_menu 0 0 0 0 'menu/menu.html' child %}")
  80
+            self.assertRaises(TemplateSyntaxError, tpl.render, context)
  81
+    
74 82
     def test_basic_cms_menu(self):
75 83
         self.assertEqual(len(menu_pool.menus), 1)
76 84
         response = self.client.get(self.get_pages_root()) # path = '/'
2  docs/getting_started/installation.rst
Source Rendered
@@ -13,7 +13,7 @@ Requirements
13 13
 * `Django`_ 1.2.5 (or a 1.3.x release).
14 14
 * `South`_ 0.7.2 or higher
15 15
 * `PIL`_ 1.1.6 or higher
16  
-* `django-classy-tags`_ 0.3.2 or higher
  16
+* `django-classy-tags`_ 0.3.4.1 or higher
17 17
 * `django-mptt`_ 0.4.2 or higher
18 18
 * `django-sekizai`_ 0.4.2 or higher
19 19
 * An installed and working instance of one of the databases listed in the
8  menus/templatetags/menu_tags.py
... ...
@@ -1,5 +1,5 @@
@@ -104,9 +104,9 @@ class ShowMenu(InclusionTag):
2  setup.py
@@ -29,7 +29,7 @@
29 29
     classifiers=CLASSIFIERS,
30 30
     install_requires=[
31 31
         'Django>=1.2.5',
32  
-        'django-classy-tags>=0.3.3',
  32
+        'django-classy-tags>=0.3.4.1',
33 33
         'south>=0.7.2',
34 34
         'django-mptt>=0.4.2',
35 35
         'django-sekizai>=0.4.2',

0 notes on commit 16086e1

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