diff options
-rw-r--r-- | paste/__init__.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/paste/__init__.py b/paste/__init__.py index 6e93923..c54791b 100644 --- a/paste/__init__.py +++ b/paste/__init__.py @@ -169,13 +169,7 @@ def authenticate(get_auth: Callable[[Env], Auth]) -> Middleware: return authenticate -@catch_exceptions -@validate_method -@options -@if_none_match -@open_database -@authenticate(lambda environ: Auth(environ["paste.db_conn"])) -def application(environ: Env, start_response: StartResponse) -> Response: +def application(environ: Env, start_response: StartResponse, /) -> Response: store = Store(environ["paste.db_conn"]) name = environ["PATH_INFO"] if environ["REQUEST_METHOD"] == "GET": @@ -243,3 +237,16 @@ def application(environ: Env, start_response: StartResponse) -> Response: return [] return simple_response(start_response, "404 Not Found") return simple_response(start_response, "500 Internal Server Error") + + +middlewares = [ + catch_exceptions, + validate_method, + options, + if_none_match, + open_database, + authenticate(lambda environ: Auth(environ["paste.db_conn"])), +] + +for m in reversed(middlewares): + application = m(application) |