~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Install `mercurial`_
-2. ``svn co http://dev.pocoo.org/hg/jinja2-main jinja2``
+2. ``hg clone http://dev.pocoo.org/hg/jinja2-main jinja2``
3. ``cd jinja2``
4. ``ln -s jinja2 /usr/lib/python2.X/site-packages``
self.__name__ = template.name
__html__ = lambda x: Markup(concat(x._body_stream))
- __unicode__ = lambda x: unicode(concat(x._body_stream))
+ __unicode__ = lambda x: concat(x._body_stream)
def __str__(self):
return unicode(self).encode('utf-8')
return name in self.vars or name in self.parent
def __getitem__(self, key):
- """Lookup a variable or raise `KeyError`."""
- if key in self.vars:
- return self.vars[key]
- return self.parent[key]
+ """Lookup a variable or raise `KeyError` if the variable is
+ undefined.
+ """
+ item = self.resolve(key)
+ if isinstance(item, Undefined):
+ raise KeyError(key)
+ return item
def __repr__(self):
return '<%s %s of %r>' % (