Coverage for /home/runner/work/viur-core/viur-core/viur/src/viur/core/render/abstract.py: 0%
23 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-02-07 19:28 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2025-02-07 19:28 +0000
1import abc
2import typing as t
4from viur.core.module import Module
5from viur.core.skeleton import SkelList, SkeletonInstance
8class AbstractRenderer(abc.ABC):
9 parent: Module | None = None
11 def __init__(self, parent: Module = None):
12 super().__init__()
13 self.parent = parent
15 @property
16 @abc.abstractmethod
17 def kind(self) -> str:
18 """Renderer type specifier"""
19 ...
21 @abc.abstractmethod
22 def list(
23 self,
24 skellist: SkelList,
25 action: str = "list",
26 params: t.Any = None,
27 **kwargs,
28 ) -> str:
29 """
30 Renders a response with a list of entries.
32 :param skellist: List of Skeletons with entries to display.
33 :param action: The name of the action, which is passed into the result.
34 :param params: Optional data that will be passed unmodified to the template
35 """
36 ...
38 @abc.abstractmethod
39 def view(
40 self,
41 skel: SkeletonInstance,
42 action: str = "view",
43 params: t.Any = None,
44 **kwargs,
45 ) -> str:
46 """
47 Renders a response for viewing an entry.
48 """
49 ...
51 def add(
52 self,
53 skel: SkeletonInstance,
54 action: str = "add",
55 params: t.Any = None,
56 **kwargs,
57 ) -> str:
58 """
59 Renders a response for adding an entry.
60 """
61 ...
63 def edit(
64 self,
65 skel: SkeletonInstance,
66 action: str = "edit",
67 params: t.Any = None,
68 **kwargs,
69 ) -> str:
70 """
71 Renders a response for modifying an entry.
72 """
73 ...