Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using the menu tag wrong (eg give a page as 'namespace') the menu ta #935

Merged
merged 3 commits into from
Aug 14, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion cms/tests/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from django.contrib.auth.models import AnonymousUser, User, Permission, Group
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.template import Template
from django.template import Template, TemplateSyntaxError
from menus.base import NavigationNode
from menus.menu_pool import menu_pool, _build_nodes_inner_for_one_menu
from menus.utils import mark_descendants, find_selected, cut_levels
Expand Down Expand Up @@ -71,6 +71,14 @@ def get_level(self, num):
def get_all_pages(self):
return Page.objects.all()

def test_menu_failfast_on_invalid_usage(self):
context = self.get_context()
context['child'] = self.get_page(1)
# test standard show_menu
with SettingsOverride(DEBUG=True, TEMPLATE_DEBUG=True):
tpl = Template("{% load menu_tags %}{% show_menu 0 0 0 0 'menu/menu.html' child %}")
self.assertRaises(TemplateSyntaxError, tpl.render, context)

def test_basic_cms_menu(self):
self.assertEqual(len(menu_pool.menus), 1)
response = self.client.get(self.get_pages_root()) # path = '/'
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Requirements
* `Django`_ 1.2.5 (or a 1.3.x release).
* `South`_ 0.7.2 or higher
* `PIL`_ 1.1.6 or higher
* `django-classy-tags`_ 0.3.2 or higher
* `django-classy-tags`_ 0.3.4.1 or higher
* `django-mptt`_ 0.4.2 or higher
* `django-sekizai`_ 0.4.2 or higher
* An installed and working instance of one of the databases listed in the
Expand Down
8 changes: 4 additions & 4 deletions menus/templatetags/menu_tags.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from classytags.arguments import IntegerArgument, Argument
from classytags.arguments import IntegerArgument, Argument, StringArgument
from classytags.core import Options
from classytags.helpers import InclusionTag
from django import template
Expand Down Expand Up @@ -104,9 +104,9 @@ class ShowMenu(InclusionTag):
IntegerArgument('to_level', default=100, required=False),
IntegerArgument('extra_inactive', default=0, required=False),
IntegerArgument('extra_active', default=1000, required=False),
Argument('template', default='menu/menu.html', required=False),
Argument('namespace', default=None, required=False),
Argument('root_id', default=None, required=False),
StringArgument('template', default='menu/menu.html', required=False),
StringArgument('namespace', default=None, required=False),
StringArgument('root_id', default=None, required=False),
Argument('next_page', default=None, required=False),
)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
classifiers=CLASSIFIERS,
install_requires=[
'Django>=1.2.5',
'django-classy-tags>=0.3.3',
'django-classy-tags>=0.3.4.1',
'south>=0.7.2',
'django-mptt>=0.4.2',
'django-sekizai>=0.4.2',
Expand Down