Some cleanups

This commit is contained in:
Armin Ronacher 2013-09-02 04:57:01 +06:00
parent 51d7c8de7d
commit 8f1dada542
3 changed files with 3 additions and 4 deletions

View file

@ -1158,7 +1158,6 @@ class Flask(_PackageBoundObject):
""" """
self.jinja_env.tests[name or f.__name__] = f self.jinja_env.tests[name or f.__name__] = f
@setupmethod @setupmethod
def template_global(self, name=None): def template_global(self, name=None):
"""A decorator that is used to register a custom template global function. """A decorator that is used to register a custom template global function.
@ -1710,7 +1709,7 @@ class Flask(_PackageBoundObject):
if bp is not None and bp in self.teardown_request_funcs: if bp is not None and bp in self.teardown_request_funcs:
funcs = chain(funcs, reversed(self.teardown_request_funcs[bp])) funcs = chain(funcs, reversed(self.teardown_request_funcs[bp]))
for func in funcs: for func in funcs:
rv = func(exc) func(exc)
request_tearing_down.send(self, exc=exc) request_tearing_down.send(self, exc=exc)
def do_teardown_appcontext(self, exc=None): def do_teardown_appcontext(self, exc=None):

View file

@ -78,7 +78,7 @@ def attach_enctype_error_multidict(request):
def __getitem__(self, key): def __getitem__(self, key):
try: try:
return oldcls.__getitem__(self, key) return oldcls.__getitem__(self, key)
except KeyError as e: except KeyError:
if key not in request.form: if key not in request.form:
raise raise
raise DebugFilesKeyError(request, key) raise DebugFilesKeyError(request, key)

View file

@ -232,7 +232,7 @@ def jsonify(*args, **kwargs):
""" """
indent = None indent = None
if current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] \ if current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] \
and not request.is_xhr: and not request.is_xhr:
indent = 2 indent = 2
return current_app.response_class(dumps(dict(*args, **kwargs), return current_app.response_class(dumps(dict(*args, **kwargs),
indent=indent), indent=indent),