added a semi realworld benchmark (jinja2 and mako)
--HG--
branch : trunk
diff --git a/jinja2/compiler.py b/jinja2/compiler.py
index 30054e7..2839264 100644
--- a/jinja2/compiler.py
+++ b/jinja2/compiler.py
@@ -273,6 +273,9 @@
if isinstance(node.arg, nodes.Const) and \
isinstance(node.arg.value, basestring) and \
((isinstance(node.node, nodes.Name) and
+ # this code ignores parameter declared names as the may only
+ # occour at the very beginning of a scope and we pull the
+ # attributes afterwards.
node.node.name not in (self.identifiers.declared_locally)) or
node.node in self.identifiers.static_subscribes):
if node in self.identifiers.static_subscribes:
@@ -281,7 +284,6 @@
self.identifiers.static_subscribes[node] = 1
def visit_Macro(self, node):
- self.generic_visit(node)
self.identifiers.declared_locally.add(node.name)
def visit_Import(self, node):
@@ -665,7 +667,7 @@
self.writeline('import %s as %s' % (imp, alias))
# add the load name
- self.writeline('name = %r' % self.filename)
+ self.writeline('name = %r' % self.name)
# generate the root render function.
self.writeline('def root(context, environment=environment):', extra=1)
@@ -849,7 +851,7 @@
self.writeline('if l_%s is missing:' % alias)
self.indent()
self.writeline('l_%s = environment.undefined(%r %% '
- 'included_template.name, '
+ 'included_template.__name__, '
'name=%r)' %
(alias, 'the template %r does not export '
'the requested name ' + repr(name), name))
diff --git a/jinja2/environment.py b/jinja2/environment.py
index d1206ef..f64b150 100644
--- a/jinja2/environment.py
+++ b/jinja2/environment.py
@@ -609,7 +609,7 @@
if self.__name__ is None:
name = 'memory:%x' % id(self)
else:
- name = repr(self.name)
+ name = repr(self.__name__)
return '<%s %s>' % (self.__class__.__name__, name)
diff --git a/jinja2/runtime.py b/jinja2/runtime.py
index b5f0783..17a5996 100644
--- a/jinja2/runtime.py
+++ b/jinja2/runtime.py
@@ -21,10 +21,10 @@
'markup_join', 'unicode_join']
-def markup_join(*args):
+def markup_join(seq):
"""Concatenation that escapes if necessary and converts to unicode."""
buf = []
- iterator = imap(soft_unicode, args)
+ iterator = imap(soft_unicode, seq)
for arg in iterator:
buf.append(arg)
if hasattr(arg, '__html__'):
@@ -32,9 +32,9 @@
return concat(buf)
-def unicode_join(*args):
+def unicode_join(seq):
"""Simple args to unicode conversion and concatenation."""
- return concat(imap(unicode, args))
+ return concat(imap(unicode, seq))
class Context(object):