From 9d42abf3203303d7c512ac1f6d1e37f57c5681b2 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Wed, 14 May 2008 18:10:41 +0200 Subject: [PATCH] the two escape implementations work the same now, updated jinja2-debug to load the i18n extension --HG-- branch : trunk --- jinja2-debug.py | 2 +- jinja2/compiler.py | 2 +- jinja2/ext.py | 9 ++++----- jinja2/utils.py | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/jinja2-debug.py b/jinja2-debug.py index 1e90242..f2fa94a 100755 --- a/jinja2-debug.py +++ b/jinja2-debug.py @@ -13,7 +13,7 @@ import sys import jinja2 from werkzeug import script -env = jinja2.Environment() +env = jinja2.Environment(extensions=['jinja2.ext.i18n']) def shell_init_func(): def _compile(x): diff --git a/jinja2/compiler.py b/jinja2/compiler.py index 6e05040..f835835 100644 --- a/jinja2/compiler.py +++ b/jinja2/compiler.py @@ -712,7 +712,7 @@ class CodeGenerator(NodeVisitor): raise CompilerExit() self.outdent() - self.writeline('parent_template = environment.get_template(', node, 1) + self.writeline('parent_template = environment.get_template(', node) self.visit(node.template, frame) self.write(', %r)' % self.name) self.writeline('for name, parent_block in parent_template.' diff --git a/jinja2/ext.py b/jinja2/ext.py index 117c2f3..119fe4e 100644 --- a/jinja2/ext.py +++ b/jinja2/ext.py @@ -35,11 +35,10 @@ class ExtensionRegistry(type): class Extension(object): """Extensions can be used to add extra functionality to the Jinja template - system at the parser level. This is a supported but currently - undocumented interface. Custom extensions are bound to an environment but - may not store environment specific data on `self`. The reason for this is - that an extension can be bound to another environment (for overlays) by - creating a copy and reassigning the `environment` attribute. + system at the parser level. Custom extensions are bound to an environment + but may not store environment specific data on `self`. The reason for + this is that an extension can be bound to another environment (for + overlays) by creating a copy and reassigning the `environment` attribute. As extensions are created by the environment they cannot accept any arguments for configuration. One may want to work around that by using diff --git a/jinja2/utils.py b/jinja2/utils.py index cc60211..313a53e 100644 --- a/jinja2/utils.py +++ b/jinja2/utils.py @@ -497,7 +497,7 @@ except ImportError: .replace('>', '>') .replace('<', '<') .replace("'", ''') - .replace('"', '"') + .replace('"', '"') ) def soft_unicode(s): -- 2.26.2