GeneralManager 0.4.6__py3-none-any.whl → 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- general_manager/apps.py +1 -1
- general_manager/manager/meta.py +18 -5
- {generalmanager-0.4.6.dist-info → generalmanager-0.5.0.dist-info}/METADATA +1 -1
- {generalmanager-0.4.6.dist-info → generalmanager-0.5.0.dist-info}/RECORD +7 -7
- {generalmanager-0.4.6.dist-info → generalmanager-0.5.0.dist-info}/WHEEL +0 -0
- {generalmanager-0.4.6.dist-info → generalmanager-0.5.0.dist-info}/licenses/LICENSE +0 -0
- {generalmanager-0.4.6.dist-info → generalmanager-0.5.0.dist-info}/top_level.txt +0 -0
general_manager/apps.py
CHANGED
@@ -41,7 +41,7 @@ class GeneralmanagerConfig(AppConfig):
|
|
41
41
|
attributes = general_manager_class.Interface.getAttributes()
|
42
42
|
setattr(general_manager_class, "_attributes", attributes)
|
43
43
|
GeneralManagerMeta.createAtPropertiesForAttributes(
|
44
|
-
attributes, general_manager_class
|
44
|
+
attributes.keys(), general_manager_class
|
45
45
|
)
|
46
46
|
|
47
47
|
if getattr(settings, "AUTOCREATE_GRAPHQL", False):
|
general_manager/manager/meta.py
CHANGED
@@ -3,7 +3,7 @@ from general_manager.interface.baseInterface import (
|
|
3
3
|
InterfaceBase,
|
4
4
|
)
|
5
5
|
from django.conf import settings
|
6
|
-
from typing import Any, Type, TYPE_CHECKING, Generic, TypeVar
|
6
|
+
from typing import Any, Type, TYPE_CHECKING, Generic, TypeVar, Iterable
|
7
7
|
|
8
8
|
if TYPE_CHECKING:
|
9
9
|
from general_manager.interface.databaseInterface import ReadOnlyInterface
|
@@ -12,6 +12,10 @@ if TYPE_CHECKING:
|
|
12
12
|
GeneralManagerType = TypeVar("GeneralManagerType", bound="GeneralManager")
|
13
13
|
|
14
14
|
|
15
|
+
class _nonExistent:
|
16
|
+
pass
|
17
|
+
|
18
|
+
|
15
19
|
class GeneralManagerMeta(type):
|
16
20
|
all_classes: list[Type[GeneralManager]] = []
|
17
21
|
read_only_classes: list[Type[ReadOnlyInterface]] = []
|
@@ -48,7 +52,7 @@ class GeneralManagerMeta(type):
|
|
48
52
|
|
49
53
|
@staticmethod
|
50
54
|
def createAtPropertiesForAttributes(
|
51
|
-
attributes:
|
55
|
+
attributes: Iterable[str], new_class: Type[GeneralManager]
|
52
56
|
):
|
53
57
|
|
54
58
|
def desciptorMethod(attr_name: str, new_class: type):
|
@@ -64,12 +68,21 @@ class GeneralManagerMeta(type):
|
|
64
68
|
):
|
65
69
|
if instance is None:
|
66
70
|
return self.new_class.Interface.getFieldType(self.attr_name)
|
67
|
-
attribute = instance._attributes
|
71
|
+
attribute = instance._attributes.get(attr_name, _nonExistent)
|
72
|
+
if attribute is _nonExistent:
|
73
|
+
raise AttributeError(
|
74
|
+
f"{self.attr_name} not found in {instance.__class__.__name__}"
|
75
|
+
)
|
68
76
|
if callable(attribute):
|
69
|
-
|
77
|
+
try:
|
78
|
+
attribute = attribute(instance._interface)
|
79
|
+
except Exception as e:
|
80
|
+
raise AttributeError(
|
81
|
+
f"Error calling attribute {self.attr_name}: {e}"
|
82
|
+
) from e
|
70
83
|
return attribute
|
71
84
|
|
72
85
|
return Descriptor(attr_name, new_class)
|
73
86
|
|
74
|
-
for attr_name in attributes
|
87
|
+
for attr_name in attributes:
|
75
88
|
setattr(new_class, attr_name, desciptorMethod(attr_name, new_class))
|
@@ -1,5 +1,5 @@
|
|
1
1
|
general_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
general_manager/apps.py,sha256
|
2
|
+
general_manager/apps.py,sha256=0QwuIAnhHm5u0wTlCiDVsl8k0RU0BEgfFjmBMl9zvsw,3320
|
3
3
|
general_manager/api/graphql.py,sha256=L-UUiDDOe1s5mhXs9nBNf0f7PXz9JLloUfyrXbjIfIs,27408
|
4
4
|
general_manager/api/mutation.py,sha256=uu5RVxc9wbb-Zrbtt4azegvyKymMqEsxk_CkerKCd9Q,5178
|
5
5
|
general_manager/api/property.py,sha256=oc93p1P8dcIvrNorRuqD1EJVsd6eYttYhZuAS0s28gs,696
|
@@ -27,7 +27,7 @@ general_manager/manager/__init__.py,sha256=l3RYp62aEhj3Y975_XUTIzo35LUnkTJHkb_hg
|
|
27
27
|
general_manager/manager/generalManager.py,sha256=L470Jevvh87doI5leUbTa9P6weIdekRZ6OTorqN-WpY,6091
|
28
28
|
general_manager/manager/groupManager.py,sha256=O4FABqbm7KlZw6t36Ot3HU1FsBYN0h6Zhmk7ktN8a-Y,10087
|
29
29
|
general_manager/manager/input.py,sha256=iKawV3P1QICz-0AQUF00OvH7LZYxussg3svpvCUl8hE,2977
|
30
|
-
general_manager/manager/meta.py,sha256=
|
30
|
+
general_manager/manager/meta.py,sha256=Km4axFpDKI_Wx000dOok5jUwjJVqq5QJG9XhrWRw5mo,3624
|
31
31
|
general_manager/measurement/__init__.py,sha256=X97meFujBldE5v0WMF7SmKeGpC5R0JTczfLo_Lq1Xek,84
|
32
32
|
general_manager/measurement/measurement.py,sha256=e_FjHieeJbBtjXGCO9J7vRPw6KCkMrOxwWjaD0m8ee4,11777
|
33
33
|
general_manager/measurement/measurementField.py,sha256=iq9Hqe6ZGX8CxXm4nIqTAWTRkQVptzpqE9ExX-jFyNs,5928
|
@@ -40,8 +40,8 @@ general_manager/permission/permissionDataManager.py,sha256=Ji7fsnuaKTa6M8yzCGyzr
|
|
40
40
|
general_manager/rule/__init__.py,sha256=4Har5cfPD1fmOsilTDod-ZUz3Com-tkl58jz7yY4fD0,23
|
41
41
|
general_manager/rule/handler.py,sha256=z8SFHTIZ0LbLh3fV56Mud0V4_OvWkqJjlHvFqau7Qfk,7334
|
42
42
|
general_manager/rule/rule.py,sha256=3FVCKGL7BTVoStdgOTdWQwuoVRIxAIAilV4VOzouDpc,10759
|
43
|
-
generalmanager-0.
|
44
|
-
generalmanager-0.
|
45
|
-
generalmanager-0.
|
46
|
-
generalmanager-0.
|
47
|
-
generalmanager-0.
|
43
|
+
generalmanager-0.5.0.dist-info/licenses/LICENSE,sha256=YGFm0ieb4KpkMRRt2qnWue6uFh0cUMtobwEBkHwajhc,1450
|
44
|
+
generalmanager-0.5.0.dist-info/METADATA,sha256=x_8Yw5IpORQc7MOjzTp-J_vmcuptPWmTFL7zkGUEI7c,6528
|
45
|
+
generalmanager-0.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
46
|
+
generalmanager-0.5.0.dist-info/top_level.txt,sha256=sTDtExP9ga-YP3h3h42yivUY-A2Q23C2nw6LNKOho4I,16
|
47
|
+
generalmanager-0.5.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|