forked from orbit-oss/flask
Latest iteration of the blueprint code. Far from being done
This commit is contained in:
parent
673fa18e6d
commit
7a08331ac0
8 changed files with 304 additions and 274 deletions
11
flask/ctx.py
11
flask/ctx.py
|
|
@ -13,6 +13,7 @@ from werkzeug.exceptions import HTTPException
|
|||
|
||||
from .globals import _request_ctx_stack
|
||||
from .session import _NullSession
|
||||
from .module import blueprint_is_module
|
||||
|
||||
|
||||
class _RequestGlobals(object):
|
||||
|
|
@ -96,6 +97,16 @@ class RequestContext(object):
|
|||
except HTTPException, e:
|
||||
self.request.routing_exception = e
|
||||
|
||||
# Support for deprecated functionality. This is doing away with
|
||||
# Flask 1.0
|
||||
blueprint = self.request.blueprint
|
||||
if blueprint is not None:
|
||||
# better safe than sorry, we don't want to break code that
|
||||
# already worked
|
||||
bp = app.blueprints.get(blueprint)
|
||||
if bp is not None and blueprint_is_module(bp):
|
||||
self.request._is_old_module = True
|
||||
|
||||
def push(self):
|
||||
"""Binds the request context to the current context."""
|
||||
_request_ctx_stack.push(self)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue