"""Raised to tell the user that there is a problem with the template."""
def __init__(self, message, lineno, name):
- TEmplateError.__init__(self, '%s (line %s)' % (message, lineno))
+ TemplateError.__init__(self, '%s (line %s)' % (message, lineno))
self.message = message
self.lineno = lineno
self.name = name
"""
# if the delimiter doesn't have an html representation we check
# if any of the items has. If yes we do a coercion to Markup
- if not hasttr(d, '__html__'):
+ if not hasattr(d, '__html__'):
value = list(value)
do_escape = False
for idx, item in enumerate(value):
return self.__unicode__().encode('utf-8')
def __repr__(self):
- return 'undefined'
+ return 'Undefined'
def __len__(self):
return 0
class StrictUndefined(Undefined):
- """An undefined that barks on print and iteration."""
+ """An undefined that barks on print and iteration as well as boolean tests.
+ In other words: you can do nothing with it except checking if it's defined
+ using the `defined` test.
+ """
- __iter__ = __unicode__ = __len__ = Undefined._fail_with_error
+ __iter__ = __unicode__ = __len__ = __nonzero__ = Undefined._fail_with_error