Changeset 7089 for django/trunk/django/template/__init__.py
- Timestamp:
- 02/05/08 17:41:48 (1 year ago)
- Files:
-
- django/trunk/django/template/__init__.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/template/__init__.py
r7084 r7089 290 290 291 291 def extend_nodelist(self, nodelist, node, token): 292 if (node.must_be_first and nodelist and 293 (not isinstance(nodelist[0], TextNode) or len(nodelist) > 2)): 294 raise TemplateSyntaxError("%r must be the first tag in the template." % node) 292 if node.must_be_first and nodelist: 293 try: 294 if nodelist.contains_nontext: 295 raise AttributeError 296 except AttributeError: 297 raise TemplateSyntaxError("%r must be the first tag in the template." % node) 298 if isinstance(nodelist, NodeList) and not isinstance(node, TextNode): 299 nodelist.contains_nontext = True 295 300 nodelist.append(node) 296 301 … … 733 738 734 739 class NodeList(list): 740 # Set to True the first time a non-TextNode is inserted by 741 # extend_nodelist(). 742 contains_nontext = False 743 735 744 def render(self, context): 736 745 bits = []
