forked from orbit-oss/flask
In 0.7, make_default_options_response is a public API
This commit is contained in:
parent
43ae651c30
commit
952967fcab
2 changed files with 12 additions and 2 deletions
4
CHANGES
4
CHANGES
|
|
@ -8,6 +8,10 @@ Version 0.7
|
||||||
|
|
||||||
Release date to be announced, codename to be selected
|
Release date to be announced, codename to be selected
|
||||||
|
|
||||||
|
- Added :meth:`~flask.Flask.make_default_options_response`
|
||||||
|
which can be used by subclasses to alter the default
|
||||||
|
behaviour for `OPTIONS` responses.
|
||||||
|
|
||||||
Version 0.6.1
|
Version 0.6.1
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
|
||||||
10
flask/app.py
10
flask/app.py
|
|
@ -690,13 +690,19 @@ class Flask(_PackageBoundObject):
|
||||||
# if we provide automatic options for this URL and the
|
# if we provide automatic options for this URL and the
|
||||||
# request came with the OPTIONS method, reply automatically
|
# request came with the OPTIONS method, reply automatically
|
||||||
if rule.provide_automatic_options and req.method == 'OPTIONS':
|
if rule.provide_automatic_options and req.method == 'OPTIONS':
|
||||||
return self._make_default_options_response()
|
return self.make_default_options_response()
|
||||||
# otherwise dispatch to the handler for that endpoint
|
# otherwise dispatch to the handler for that endpoint
|
||||||
return self.view_functions[rule.endpoint](**req.view_args)
|
return self.view_functions[rule.endpoint](**req.view_args)
|
||||||
except HTTPException, e:
|
except HTTPException, e:
|
||||||
return self.handle_http_exception(e)
|
return self.handle_http_exception(e)
|
||||||
|
|
||||||
def _make_default_options_response(self):
|
def make_default_options_response(self):
|
||||||
|
"""This method is called to create the default `OPTIONS` response.
|
||||||
|
This can be changed through subclassing to change the default
|
||||||
|
behaviour of `OPTIONS` responses.
|
||||||
|
|
||||||
|
.. versionadded:: 0.7
|
||||||
|
"""
|
||||||
# This would be nicer in Werkzeug 0.7, which however currently
|
# This would be nicer in Werkzeug 0.7, which however currently
|
||||||
# is not released. Werkzeug 0.7 provides a method called
|
# is not released. Werkzeug 0.7 provides a method called
|
||||||
# allowed_methods() that returns all methods that are valid for
|
# allowed_methods() that returns all methods that are valid for
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue