clean up outdated code

This commit is contained in:
linchiwei123 2019-07-24 15:50:37 +08:00
parent fb4aab5d89
commit a0a49e1c9e

View file

@ -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