From c983ab3e16cf74516fbb622037c9c3557f3afba0 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 17 Jan 2006 12:47:12 +0000 Subject: [PATCH] magic-removal: Fixed template unit tests. Corrected expected output for 'spaceless' tests, added extra error condition for cycle tests. git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2030 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/template/defaulttags.py | 2 ++ tests/othertests/templates.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 1a4e1eda10..18f1b9ab30 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -344,6 +344,8 @@ def cycle(parser, token): elif len(args) == 2: name = args[1] + if not hasattr(parser, '_namedCycleNodes'): + raise TemplateSyntaxError("No named cycles in template: '%s' is not defined" % name) if not parser._namedCycleNodes.has_key(name): raise TemplateSyntaxError("Named cycle '%s' does not exist" % name) return parser._namedCycleNodes[name] diff --git a/tests/othertests/templates.py b/tests/othertests/templates.py index 122c1ed965..48da3441f3 100644 --- a/tests/othertests/templates.py +++ b/tests/othertests/templates.py @@ -317,8 +317,8 @@ TEMPLATE_TESTS = { ### I18N ################################################################## # {% spaceless %} tag - 'spaceless01': ("{% spaceless %} text {% endspaceless %}", {}, " text "), - 'spaceless02': ("{% spaceless %} \n text \n {% endspaceless %}", {}, " text "), + 'spaceless01': ("{% spaceless %} text {% endspaceless %}", {}, " text "), + 'spaceless02': ("{% spaceless %} \n text \n {% endspaceless %}", {}, " text "), 'spaceless03': ("{% spaceless %}text{% endspaceless %}", {}, "text"), # simple translation of a string delimited by '