From 659db071a137b1a9725d231e9231494aca737b87 Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Sun, 19 Sep 2021 14:28:24 +0300 Subject: [PATCH] raise httpexception instead of returning it from a function --- src/ahriman/web/views/service/add.py | 2 +- src/ahriman/web/views/service/reload_auth.py | 2 +- src/ahriman/web/views/service/remove.py | 2 +- src/ahriman/web/views/status/ahriman.py | 2 +- src/ahriman/web/views/status/package.py | 4 ++-- src/ahriman/web/views/status/packages.py | 2 +- src/ahriman/web/views/user/login.py | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ahriman/web/views/service/add.py b/src/ahriman/web/views/service/add.py index 8406f296..ed507faa 100644 --- a/src/ahriman/web/views/service/add.py +++ b/src/ahriman/web/views/service/add.py @@ -49,4 +49,4 @@ class AddView(BaseView): self.spawner.packages_add(packages, now) - return HTTPFound("/") + raise HTTPFound("/") diff --git a/src/ahriman/web/views/service/reload_auth.py b/src/ahriman/web/views/service/reload_auth.py index fb9cf64d..36fcab40 100644 --- a/src/ahriman/web/views/service/reload_auth.py +++ b/src/ahriman/web/views/service/reload_auth.py @@ -45,4 +45,4 @@ class ReloadAuthView(BaseView): self.request.app.logger.warning("could not update authentication module validator", exc_info=True) raise - return HTTPNoContent() + raise HTTPNoContent() diff --git a/src/ahriman/web/views/service/remove.py b/src/ahriman/web/views/service/remove.py index 484989b2..bbb3da16 100644 --- a/src/ahriman/web/views/service/remove.py +++ b/src/ahriman/web/views/service/remove.py @@ -47,4 +47,4 @@ class RemoveView(BaseView): self.spawner.packages_remove(packages) - return HTTPFound("/") + raise HTTPFound("/") diff --git a/src/ahriman/web/views/status/ahriman.py b/src/ahriman/web/views/status/ahriman.py index 8ffcb3c9..c04e14c5 100644 --- a/src/ahriman/web/views/status/ahriman.py +++ b/src/ahriman/web/views/status/ahriman.py @@ -55,4 +55,4 @@ class AhrimanView(BaseView): self.service.update_self(status) - return HTTPNoContent() + raise HTTPNoContent() diff --git a/src/ahriman/web/views/status/package.py b/src/ahriman/web/views/status/package.py index 2d8a97e2..22672bba 100644 --- a/src/ahriman/web/views/status/package.py +++ b/src/ahriman/web/views/status/package.py @@ -58,7 +58,7 @@ class PackageView(BaseView): base = self.request.match_info["package"] self.service.remove(base) - return HTTPNoContent() + raise HTTPNoContent() async def post(self) -> Response: """ @@ -87,4 +87,4 @@ class PackageView(BaseView): except UnknownPackage: return json_response(data=f"Package {base} is unknown, but no package body set", status=400) - return HTTPNoContent() + raise HTTPNoContent() diff --git a/src/ahriman/web/views/status/packages.py b/src/ahriman/web/views/status/packages.py index bd9ed319..57d0768e 100644 --- a/src/ahriman/web/views/status/packages.py +++ b/src/ahriman/web/views/status/packages.py @@ -47,4 +47,4 @@ class PackagesView(BaseView): """ self.service.load() - return HTTPNoContent() + raise HTTPNoContent() diff --git a/src/ahriman/web/views/user/login.py b/src/ahriman/web/views/user/login.py index 7065d9e4..de32ef01 100644 --- a/src/ahriman/web/views/user/login.py +++ b/src/ahriman/web/views/user/login.py @@ -46,7 +46,7 @@ class LoginView(BaseView): raise HTTPMethodNotAllowed(self.request.method, ["POST"]) if not code: - return HTTPFound(oauth_provider.get_oauth_url()) + raise HTTPFound(oauth_provider.get_oauth_url()) response = HTTPFound("/") username = await oauth_provider.get_oauth_username(code)