- Added librarian as a submodule.
[wolnelektury.git] / apps / catalogue / templatetags / switch_tag.py
index b91f872..72476be 100644 (file)
@@ -1,11 +1,11 @@
 # 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
@@ -71,13 +71,13 @@ def do_switch(parser, token):
     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)
@@ -122,7 +122,7 @@ class SwitchNode(Node):
         except VariableDoesNotExist:
             no_value = True
             value_missing = None
-        
+
         for tests, nodelist in self.cases:
             if tests is None:
                 return nodelist.render(context)