|
|
|
@ -343,7 +343,11 @@ class Flask(_PackageBoundObject):
|
|
|
|
|
|
|
|
|
|
def update_template_context(self, context): |
|
|
|
|
"""Update the template context with some commonly used variables. |
|
|
|
|
This injects request, session and g into the template context. |
|
|
|
|
This injects request, session, config and g into the template |
|
|
|
|
context as well as everything template context processors want |
|
|
|
|
to inject. Note that the as of Flask 0.6, the original values |
|
|
|
|
in the context will not be overriden if a context processor |
|
|
|
|
decides to return a value with the same key. |
|
|
|
|
|
|
|
|
|
:param context: the context as a dictionary that is updated in place |
|
|
|
|
to add extra variables. |
|
|
|
@ -352,8 +356,13 @@ class Flask(_PackageBoundObject):
|
|
|
|
|
mod = _request_ctx_stack.top.request.module |
|
|
|
|
if mod is not None and mod in self.template_context_processors: |
|
|
|
|
funcs = chain(funcs, self.template_context_processors[mod]) |
|
|
|
|
orig_ctx = context.copy() |
|
|
|
|
for func in funcs: |
|
|
|
|
context.update(func()) |
|
|
|
|
# make sure the original values win. This makes it possible to |
|
|
|
|
# easier add new variables in context processors without breaking |
|
|
|
|
# existing views. |
|
|
|
|
context.update(orig_ctx) |
|
|
|
|
|
|
|
|
|
def run(self, host='127.0.0.1', port=5000, **options): |
|
|
|
|
"""Runs the application on a local development server. If the |
|
|
|
|