More refactoring and moving stuff around
This commit is contained in:
parent
a3c9494f67
commit
665fa2a32b
3 changed files with 15 additions and 14 deletions
|
|
@ -24,11 +24,12 @@ from flask.helpers import _PackageBoundObject, url_for, get_flashed_messages, \
|
|||
_tojson_filter
|
||||
from flask.wrappers import Request, Response
|
||||
from flask.config import ConfigAttribute, Config
|
||||
from flask.ctx import _default_template_ctx_processor, _RequestContext
|
||||
from flask.ctx import _RequestContext
|
||||
from flask.globals import _request_ctx_stack, request
|
||||
from flask.session import Session, _NullSession
|
||||
from flask.module import _ModuleSetupState
|
||||
from flask.templating import _DispatchingJinjaLoader
|
||||
from flask.templating import _DispatchingJinjaLoader, \
|
||||
_default_template_ctx_processor
|
||||
|
||||
# a lock used for logger initialization
|
||||
_logger_lock = Lock()
|
||||
|
|
@ -831,4 +832,3 @@ class Flask(_PackageBoundObject):
|
|||
def __call__(self, environ, start_response):
|
||||
"""Shortcut for :attr:`wsgi_app`."""
|
||||
return self.wsgi_app(environ, start_response)
|
||||
|
||||
|
|
|
|||
11
flask/ctx.py
11
flask/ctx.py
|
|
@ -63,14 +63,3 @@ class _RequestContext(object):
|
|||
if not self.request.environ.get('flask._preserve_context') and \
|
||||
(tb is None or not self.app.debug):
|
||||
self.pop()
|
||||
|
||||
def _default_template_ctx_processor():
|
||||
"""Default template context processor. Injects `request`,
|
||||
`session` and `g`.
|
||||
"""
|
||||
reqctx = _request_ctx_stack.top
|
||||
return dict(
|
||||
request=reqctx.request,
|
||||
session=reqctx.session,
|
||||
g=reqctx.g
|
||||
)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,18 @@ from jinja2 import BaseLoader, FileSystemLoader, TemplateNotFound
|
|||
from flask.globals import _request_ctx_stack
|
||||
|
||||
|
||||
def _default_template_ctx_processor():
|
||||
"""Default template context processor. Injects `request`,
|
||||
`session` and `g`.
|
||||
"""
|
||||
reqctx = _request_ctx_stack.top
|
||||
return dict(
|
||||
request=reqctx.request,
|
||||
session=reqctx.session,
|
||||
g=reqctx.g
|
||||
)
|
||||
|
||||
|
||||
class _DispatchingJinjaLoader(BaseLoader):
|
||||
"""A loader that looks for templates in the application and all
|
||||
the module folders.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue