forked from orbit-oss/flask
commit
77753e9b73
5 changed files with 10 additions and 10 deletions
|
|
@ -91,7 +91,7 @@ else:
|
||||||
|
|
||||||
def with_metaclass(meta, *bases):
|
def with_metaclass(meta, *bases):
|
||||||
# This requires a bit of explanation: the basic idea is to make a
|
# This requires a bit of explanation: the basic idea is to make a
|
||||||
# dummy metaclass for one level of class instanciation that replaces
|
# dummy metaclass for one level of class instantiation that replaces
|
||||||
# itself with the actual metaclass. Because of internal type checks
|
# itself with the actual metaclass. Because of internal type checks
|
||||||
# we also need to make sure that we downgrade the custom metaclass
|
# we also need to make sure that we downgrade the custom metaclass
|
||||||
# for one level to something closer to type (that's why __call__ and
|
# for one level to something closer to type (that's why __call__ and
|
||||||
|
|
|
||||||
10
flask/app.py
10
flask/app.py
|
|
@ -177,7 +177,7 @@ class Flask(_PackageBoundObject):
|
||||||
|
|
||||||
#: The debug flag. Set this to `True` to enable debugging of the
|
#: The debug flag. Set this to `True` to enable debugging of the
|
||||||
#: application. In debug mode the debugger will kick in when an unhandled
|
#: application. In debug mode the debugger will kick in when an unhandled
|
||||||
#: exception ocurrs and the integrated server will automatically reload
|
#: exception occurs and the integrated server will automatically reload
|
||||||
#: the application if changes in the code are detected.
|
#: the application if changes in the code are detected.
|
||||||
#:
|
#:
|
||||||
#: This attribute can also be configured from the config with the `DEBUG`
|
#: This attribute can also be configured from the config with the `DEBUG`
|
||||||
|
|
@ -522,7 +522,7 @@ class Flask(_PackageBoundObject):
|
||||||
"""The name of the application. This is usually the import name
|
"""The name of the application. This is usually the import name
|
||||||
with the difference that it's guessed from the run file if the
|
with the difference that it's guessed from the run file if the
|
||||||
import name is main. This name is used as a display name when
|
import name is main. This name is used as a display name when
|
||||||
Flask needs the name of the application. It can be set and overriden
|
Flask needs the name of the application. It can be set and overridden
|
||||||
to change the value.
|
to change the value.
|
||||||
|
|
||||||
.. versionadded:: 0.8
|
.. versionadded:: 0.8
|
||||||
|
|
@ -697,7 +697,7 @@ class Flask(_PackageBoundObject):
|
||||||
This injects request, session, config and g into the template
|
This injects request, session, config and g into the template
|
||||||
context as well as everything template context processors want
|
context as well as everything template context processors want
|
||||||
to inject. Note that the as of Flask 0.6, the original values
|
to inject. Note that the as of Flask 0.6, the original values
|
||||||
in the context will not be overriden if a context processor
|
in the context will not be overridden if a context processor
|
||||||
decides to return a value with the same key.
|
decides to return a value with the same key.
|
||||||
|
|
||||||
:param context: the context as a dictionary that is updated in place
|
:param context: the context as a dictionary that is updated in place
|
||||||
|
|
@ -1045,7 +1045,7 @@ class Flask(_PackageBoundObject):
|
||||||
app.error_handler_spec[None][404] = page_not_found
|
app.error_handler_spec[None][404] = page_not_found
|
||||||
|
|
||||||
Setting error handlers via assignments to :attr:`error_handler_spec`
|
Setting error handlers via assignments to :attr:`error_handler_spec`
|
||||||
however is discouraged as it requires fidling with nested dictionaries
|
however is discouraged as it requires fiddling with nested dictionaries
|
||||||
and the special case for arbitrary exception types.
|
and the special case for arbitrary exception types.
|
||||||
|
|
||||||
The first `None` refers to the active blueprint. If the error
|
The first `None` refers to the active blueprint. If the error
|
||||||
|
|
@ -1550,7 +1550,7 @@ class Flask(_PackageBoundObject):
|
||||||
# When we create a response object directly, we let the constructor
|
# When we create a response object directly, we let the constructor
|
||||||
# set the headers and status. We do this because there can be
|
# set the headers and status. We do this because there can be
|
||||||
# some extra logic involved when creating these objects with
|
# some extra logic involved when creating these objects with
|
||||||
# specific values (like defualt content type selection).
|
# specific values (like default content type selection).
|
||||||
if isinstance(rv, string_types):
|
if isinstance(rv, string_types):
|
||||||
rv = self.response_class(rv, headers=headers, status=status)
|
rv = self.response_class(rv, headers=headers, status=status)
|
||||||
headers = status = None
|
headers = status = None
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,7 @@ class RequestContext(object):
|
||||||
|
|
||||||
def push(self):
|
def push(self):
|
||||||
"""Binds the request context to the current context."""
|
"""Binds the request context to the current context."""
|
||||||
# If an exception ocurrs in debug mode or if context preservation is
|
# If an exception occurs in debug mode or if context preservation is
|
||||||
# activated under exception situations exactly one context stays
|
# activated under exception situations exactly one context stays
|
||||||
# on the stack. The rationale is that you want to access that
|
# on the stack. The rationale is that you want to access that
|
||||||
# information under debug situations. However if someone forgets to
|
# information under debug situations. However if someone forgets to
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ def get_template_attribute(template_name, attribute):
|
||||||
.. versionadded:: 0.2
|
.. versionadded:: 0.2
|
||||||
|
|
||||||
:param template_name: the name of the template
|
:param template_name: the name of the template
|
||||||
:param attribute: the name of the variable of macro to acccess
|
:param attribute: the name of the variable of macro to access
|
||||||
"""
|
"""
|
||||||
return getattr(current_app.jinja_env.get_template(template_name).module,
|
return getattr(current_app.jinja_env.get_template(template_name).module,
|
||||||
attribute)
|
attribute)
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ class ModuleTestCase(FlaskTestCase):
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
admin = flask.Module(__name__, 'admin', url_prefix='/admin')
|
admin = flask.Module(__name__, 'admin', url_prefix='/admin')
|
||||||
@app.context_processor
|
@app.context_processor
|
||||||
def inject_all_regualr():
|
def inject_all_regular():
|
||||||
return {'a': 1}
|
return {'a': 1}
|
||||||
@admin.context_processor
|
@admin.context_processor
|
||||||
def inject_admin():
|
def inject_admin():
|
||||||
|
|
@ -534,7 +534,7 @@ class BlueprintTestCase(FlaskTestCase):
|
||||||
|
|
||||||
c = app.test_client()
|
c = app.test_client()
|
||||||
self.assertEqual(c.get('/py/foo').data, b'bp.foo')
|
self.assertEqual(c.get('/py/foo').data, b'bp.foo')
|
||||||
# The rule's din't actually made it through
|
# The rule's didn't actually made it through
|
||||||
rv = c.get('/py/bar')
|
rv = c.get('/py/bar')
|
||||||
assert rv.status_code == 404
|
assert rv.status_code == 404
|
||||||
rv = c.get('/py/bar/123')
|
rv = c.get('/py/bar/123')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue