class ContainerNode(template.Node):
+ child_nodelists = ('nodelist_main', 'nodelist_empty',)
+
def __init__(self, name, references=None, as_var=None, nodelist_main=None, nodelist_empty=None):
self.name = name
self.as_var = as_var
self.references = references
- self.nodelist_main = nodelist_main
- self.nodelist_empty = nodelist_empty
+
+ if nodelist_main is None:
+ self.nodelist_main = template.NodeList()
+ else:
+ self.nodelist_main = nodelist_main
+
+ if nodelist_empty is None:
+ self.nodelist_empty = template.NodeList()
+ else:
+ self.nodelist_empty = nodelist_empty
def render(self, context):
content = settings.TEMPLATE_STRING_IF_INVALID
container_content = self.get_container_content(context['page'])
if self.nodelist_main is None:
+ self.nodelist_main
if container_content and self.as_var:
context[self.as_var] = container_content
return ''
else: # error
raise template.TemplateSyntaxError('"%s" template tag provided without arguments (at least one required)' % tag)
-register.tag('container', do_container)
\ No newline at end of file
+register.tag('container', do_container)
+register.tag('blockcontainer', do_container)
\ No newline at end of file