# Source: http://djangosnippets.org/snippets/967/
# Author: adurdin
# Posted: August 13, 2008
-#
-#
+#
+#
# We can use it based on djangosnippets Terms of Service:
# (http://djangosnippets.org/about/tos/)
-#
+#
# 2. That you grant any third party who sees the code you post
# a royalty-free, non-exclusive license to copy and distribute that code
# and to make and distribute derivative works based on that code. You may
got_else = False
while token.contents != 'endswitch':
nodelist = parser.parse(BlockTagList('case', 'else', 'endswitch'))
-
+
if got_else:
raise template.TemplateSyntaxError("'else' must be last tag in '%s'." % tag_name)
contents = token.contents.split()
token_name, token_args = contents[0], contents[1:]
-
+
if token_name == 'case':
tests = map(parser.compile_filter, token_args)
case = (tests, nodelist)
except VariableDoesNotExist:
no_value = True
value_missing = None
-
+
for tests, nodelist in self.cases:
if tests is None:
return nodelist.render(context)