Internal helper to for context creation.
(environment, template_name, blocks, vars=None,
shared=None, globals=None, locals=None)
| 57 | |
| 58 | |
| 59 | def new_context(environment, template_name, blocks, vars=None, |
| 60 | shared=None, globals=None, locals=None): |
| 61 | """Internal helper to for context creation.""" |
| 62 | if vars is None: |
| 63 | vars = {} |
| 64 | if shared: |
| 65 | parent = vars |
| 66 | else: |
| 67 | parent = dict(globals or (), **vars) |
| 68 | if locals: |
| 69 | # if the parent is shared a copy should be created because |
| 70 | # we don't want to modify the dict passed |
| 71 | if shared: |
| 72 | parent = dict(parent) |
| 73 | for key, value in iteritems(locals): |
| 74 | if value is not missing: |
| 75 | parent[key] = value |
| 76 | return environment.context_class(environment, parent, template_name, |
| 77 | blocks) |
| 78 | |
| 79 | |
| 80 | class TemplateReference(object): |
no outgoing calls
no test coverage detected
searching dependent graphs…