aboutsummaryrefslogtreecommitdiff
path: root/sgdfi/_util.py
diff options
context:
space:
mode:
Diffstat (limited to 'sgdfi/_util.py')
-rwxr-xr-xsgdfi/_util.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/sgdfi/_util.py b/sgdfi/_util.py
index db097d8..112f58c 100755
--- a/sgdfi/_util.py
+++ b/sgdfi/_util.py
@@ -527,4 +527,45 @@ class UnauthorizedAccountError(InvalidCredentialsError):
super().__init__(f"User with identifier {repr(user)} is not allowed " \
"to log in.", user = user)
+class RedirectError(Exception):
+ """ The response is a redirection. """
+
+ def __init__(self, location):
+ super().__init__(f"Was redirected to {repr(location)}.")
+ self.__location = location
+
+ @property
+ def location(self):
+ """ The location to which we have been redirected. """
+
+ return self.__location
+
+class BadRequestError(Exception):
+ """ The response is a redirection to the bad request page. """
+
+ def __init__(self):
+ super().__init__("Bad request.")
+
+class NotFoundError(Exception):
+ """ The response is a redirection to the not found page. """
+
+ def __init__(self):
+ super().__init__("Page not found.")
+
+class ForbiddenError(Exception):
+ """ The response is a redirection to the forbidden page. """
+
+ def __init__(self):
+ super().__init__("Access to this page was denied.")
+
+# ---
+# Other utilities.
+# ---
+
+class Pagination:
+ def __init__(self, current, number, more):
+ self.current = current
+ self.number = number
+ self.more = more
+
# End of file.