From: Armin Ronacher Date: Sun, 18 May 2008 22:23:37 +0000 (+0200) Subject: fixed an embarrassing mistake in the documentation X-Git-Tag: 2.0rc1~43 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bbbe062c7b5f12758e83abaf6db3f46153643362;p=jinja2.git fixed an embarrassing mistake in the documentation --HG-- branch : trunk --- diff --git a/docs/intro.rst b/docs/intro.rst index e1d07eb..ffb6839 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -72,7 +72,7 @@ Installing the development version ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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`` diff --git a/jinja2/environment.py b/jinja2/environment.py index 37ebdc6..f8826e6 100644 --- a/jinja2/environment.py +++ b/jinja2/environment.py @@ -604,7 +604,7 @@ class TemplateModule(object): 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') diff --git a/jinja2/runtime.py b/jinja2/runtime.py index 085120b..76eae80 100644 --- a/jinja2/runtime.py +++ b/jinja2/runtime.py @@ -140,10 +140,13 @@ class Context(object): 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>' % (