forked from orbit-oss/flask
Merge pull request #3315 from linchiwei123/cleanup
clean up outdated code
This commit is contained in:
commit
b7f6fae9b3
1 changed files with 1 additions and 12 deletions
|
|
@ -23,7 +23,6 @@ from werkzeug.exceptions import BadRequestKeyError
|
|||
from werkzeug.exceptions import default_exceptions
|
||||
from werkzeug.exceptions import HTTPException
|
||||
from werkzeug.exceptions import InternalServerError
|
||||
from werkzeug.exceptions import MethodNotAllowed
|
||||
from werkzeug.routing import BuildError
|
||||
from werkzeug.routing import Map
|
||||
from werkzeug.routing import RequestRedirect
|
||||
|
|
@ -2000,17 +1999,7 @@ class Flask(_PackageBoundObject):
|
|||
.. versionadded:: 0.7
|
||||
"""
|
||||
adapter = _request_ctx_stack.top.url_adapter
|
||||
if hasattr(adapter, "allowed_methods"):
|
||||
methods = adapter.allowed_methods()
|
||||
else:
|
||||
# fallback for Werkzeug < 0.7
|
||||
methods = []
|
||||
try:
|
||||
adapter.match(method="--")
|
||||
except MethodNotAllowed as e:
|
||||
methods = e.valid_methods
|
||||
except HTTPException:
|
||||
pass
|
||||
methods = adapter.allowed_methods()
|
||||
rv = self.response_class()
|
||||
rv.allow.update(methods)
|
||||
return rv
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue