Skip to content
Myr

make_default_options_response now tries to use Werkzeug 0.7 functionality before falling back.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent d49221b · Browse files · 1 file+12 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−11 removed

  • other:+12 added−11 removed

1 file+12 added−11 removed

modified:flask/app.py+12 added-11 removed
1303 unmodified lines
1304 behaviour of `OPTIONS` responses.13051306 .. versionadded:: 0.71307 """1308 adapter = _request_ctx_stack.top.url_adapter1308 # This would be nicer in Werkzeug 0.7, which however currently1309 # is not released. Werkzeug 0.7 provides a method called1310 # allowed_methods() that returns all methods that are valid for1311 # a given path.1312 methods = []1313 try:1314 _request_ctx_stack.top.url_adapter.match(method='--')1315 except MethodNotAllowed, e:1316 methods = e.valid_methods1317 except HTTPException, e:1318 pass1309 if hasattr(adapter, 'allowed_methods'):1310 methods = adapter.allowed_methods()1311 else:1312 # fallback for Werkzeug < 0.71313 methods = []1314 try:1315 adapter.match(method='--')1316 except MethodNotAllowed, e:1317 methods = e.valid_methods1318 except HTTPException, e:1319 pass1320 rv = self.response_class()1321 rv.allow.update(methods)1322 return rv1323
210 unmodified lines