Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/resolvers/base_connection.py
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | class BaseConnection(ABC): | ||||
def _get_after_arg(self) -> str: | def _get_after_arg(self) -> str: | ||||
""" | """ | ||||
Return the decoded next page token. Override to support a different | Return the decoded next page token. Override to support a different | ||||
cursor type | cursor type | ||||
""" | """ | ||||
# different implementation is used in SnapshotBranchConnection | # different implementation is used in SnapshotBranchConnection | ||||
try: | try: | ||||
cursor = utils.get_decoded_cursor(self.kwargs.get("after")) | cursor = utils.get_decoded_cursor(self.kwargs.get("after")) | ||||
except (UnicodeDecodeError, binascii.Error, Exception) as e: | except (UnicodeDecodeError, binascii.Error) as e: | ||||
raise PaginationError("Invalid value for argument 'after'", errors=e) | raise PaginationError("Invalid value for argument 'after'", errors=e) | ||||
return cursor | return cursor | ||||
def _get_first_arg(self) -> int: | def _get_first_arg(self) -> int: | ||||
""" """ | """ """ | ||||
# page_size is set to 50 by default | # page_size is set to 50 by default | ||||
# Input type check is not required; It is defined in schema as an int | # Input type check is not required; It is defined in schema as an int | ||||
first = self.kwargs.get("first", self._page_size) | first = self.kwargs.get("first", self._page_size) | ||||
Show All 15 Lines |