summaryrefslogtreecommitdiff
path: root/jinja2/runtime.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2009-10-26 11:53:27 +0100
committerArmin Ronacher <armin.ronacher@active-4.com>2009-10-26 11:53:27 +0100
commit2f0d65917275c29703126bc60f753ebcea9d5a89 (patch)
tree79905a20d9ef517f2fac44cfb76ca2b2b28d5ba2 /jinja2/runtime.py
parent1965e31075515c6b261a709e08314943b97a9498 (diff)
downloadjinja2-2f0d65917275c29703126bc60f753ebcea9d5a89.tar.gz
Reverted [73b04625ab54]. The old behavior is the new behavior, the other
is not consistenly implementable. --HG-- branch : trunk
Diffstat (limited to 'jinja2/runtime.py')
-rw-r--r--jinja2/runtime.py45
1 files changed, 1 insertions, 44 deletions
diff --git a/jinja2/runtime.py b/jinja2/runtime.py
index 4a61bf9..b06b39c 100644
--- a/jinja2/runtime.py
+++ b/jinja2/runtime.py
@@ -111,7 +111,7 @@ class Context(object):
def __init__(self, environment, parent, name, blocks):
self.parent = parent
- self.vars = vars = {}
+ self.vars = {}
self.environment = environment
self.exported_vars = set()
self.name = name
@@ -185,16 +185,6 @@ class Context(object):
context.blocks.update((k, list(v)) for k, v in self.blocks.iteritems())
return context
- def _block(self, block=None):
- """Creates a context that is used for block execution. Currently this
- returns a special `_BlockContext` that warns about changed behavior.
- In Jinja 2.5, this will instead just return a new context with the same
- resolve behavior. Do not call from anywhere but the generated code!
-
- :private:
- """
- return _BlockContext(self, block)
-
def _all(meth):
proxy = lambda self: getattr(self.get_all(), meth)()
proxy.__doc__ = getattr(dict, meth).__doc__
@@ -232,39 +222,6 @@ class Context(object):
)
-class _BlockContext(Context):
- """Implements a deprecation warning for the changed block assignments."""
- __slots__ = ('real_context', 'block_name')
-
- def __init__(self, real_context, block_name):
- super(_BlockContext, self).__init__(real_context.environment,
- real_context.parent,
- real_context.name, {})
- self.vars = dict(real_context.vars)
- self.exported_vars = set(real_context.exported_vars)
- self.blocks = real_context.blocks
- self.real_context = real_context
- self.block_name = block_name
-
- def resolve(self, key):
- self_rv = super(_BlockContext, self).resolve(key)
- base_rv = self.real_context.resolve(key)
- if self_rv != base_rv and not isinstance(base_rv, Undefined):
- from warnings import warn
- if self.block_name is not None:
- detail = 'accessing %r from inside block %r' \
- % (key, self.block_name)
- else:
- detail = 'accessing %r toplevel' % key
- detail += ', in template %s' % self.name
- warn(DeprecationWarning('variables set in a base template '
- 'will no longer leak into the child '
- 'context in future versions. Happened '
- 'when ' + detail))
- return base_rv
- return self_rv
-
-
# register the context as mapping if possible
try:
from collections import Mapping