Implement a base pattern for listers with no state storage
This commit is contained in:
parent
b63aa83b41
commit
734901747b
2 changed files with 60 additions and 0 deletions
|
@ -258,3 +258,13 @@ class Lister(Generic[StateType, PageType]):
|
|||
"""
|
||||
config = load_from_envvar()
|
||||
return cls.from_config(**config, **kwargs)
|
||||
|
||||
|
||||
class StatelessLister(Lister[None, PageType], Generic[PageType]):
|
||||
def state_from_dict(self, d: BackendStateType) -> None:
|
||||
"""Always return empty state"""
|
||||
return None
|
||||
|
||||
def state_to_dict(self, state: None) -> BackendStateType:
|
||||
"""Always set empty state"""
|
||||
return {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue