ramifice 0.3.22__py3-none-any.whl → 0.3.23__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.
- ramifice/decorators.py +2 -1
- ramifice/paladins/check.py +15 -11
- ramifice/pseudo_model.py +0 -8
- {ramifice-0.3.22.dist-info → ramifice-0.3.23.dist-info}/METADATA +2 -1
- {ramifice-0.3.22.dist-info → ramifice-0.3.23.dist-info}/RECORD +7 -7
- {ramifice-0.3.22.dist-info → ramifice-0.3.23.dist-info}/WHEEL +0 -0
- {ramifice-0.3.22.dist-info → ramifice-0.3.23.dist-info}/licenses/LICENSE +0 -0
ramifice/decorators.py
CHANGED
@@ -126,8 +126,9 @@ def caching(cls: Any, service_name: str, is_migrate_model: bool) -> dict[str, An
|
|
126
126
|
|
127
127
|
raw_model = cls()
|
128
128
|
raw_model.fields()
|
129
|
-
default_fields: dict[str, Any] = {
|
129
|
+
default_fields: dict[str, Any] = {}
|
130
130
|
if is_migrate_model:
|
131
|
+
default_fields["_id"] = IDField()
|
131
132
|
default_fields["created_at"] = DateTimeField()
|
132
133
|
default_fields["updated_at"] = DateTimeField()
|
133
134
|
fields = {**raw_model.__dict__, **default_fields}
|
ramifice/paladins/check.py
CHANGED
@@ -46,6 +46,7 @@ class CheckMixin(
|
|
46
46
|
"""
|
47
47
|
cls_model = self.__class__
|
48
48
|
is_migrate_model: bool = cls_model.META["is_migrate_model"] # type: ignore[attr-defined]
|
49
|
+
|
49
50
|
if not is_migrate_model and is_save:
|
50
51
|
msg = (
|
51
52
|
f"Model: `{self.full_model_name()}` > " # type: ignore[attr-defined]
|
@@ -53,16 +54,19 @@ class CheckMixin(
|
|
53
54
|
+ "For a non -migrating Model, the `is_save` parameter must be equal to` False` !"
|
54
55
|
)
|
55
56
|
raise PanicError(msg)
|
56
|
-
|
57
|
-
doc_id: ObjectId | None =
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
57
|
+
|
58
|
+
doc_id: ObjectId | None = None
|
59
|
+
is_update: bool = False
|
60
|
+
if is_migrate_model:
|
61
|
+
# Get the document ID.
|
62
|
+
doc_id = self._id.value # type: ignore[attr-defined]
|
63
|
+
# Does the document exist in the database?
|
64
|
+
is_update = doc_id is not None
|
65
|
+
# Create an identifier for a new document.
|
66
|
+
if is_save and not is_update:
|
67
|
+
doc_id = ObjectId()
|
68
|
+
self._id.value = doc_id # type: ignore[attr-defined]
|
69
|
+
|
66
70
|
result_map: dict[str, Any] = {}
|
67
71
|
# Errors from additional validation of fields.
|
68
72
|
error_map: dict[str, str] = await self.add_validation() or {} # type: ignore[attr-defined]
|
@@ -81,7 +85,7 @@ class CheckMixin(
|
|
81
85
|
"full_model_name": cls_model.META["full_model_name"], # type: ignore[attr-defined]
|
82
86
|
"is_migrate_model": is_migrate_model,
|
83
87
|
}
|
84
|
-
|
88
|
+
|
85
89
|
# Run checking fields.
|
86
90
|
for field_name, field_data in self.__dict__.items():
|
87
91
|
if callable(field_data):
|
ramifice/pseudo_model.py
CHANGED
@@ -12,7 +12,6 @@ from dateutil.parser import parse
|
|
12
12
|
|
13
13
|
from . import translations
|
14
14
|
from .errors import PanicError
|
15
|
-
from .fields import IDField # type: ignore[attr-defined]
|
16
15
|
|
17
16
|
|
18
17
|
class PseudoModel(metaclass=ABCMeta):
|
@@ -24,13 +23,6 @@ class PseudoModel(metaclass=ABCMeta):
|
|
24
23
|
META: dict[str, Any] = {}
|
25
24
|
|
26
25
|
def __init__(self) -> None: # noqa: D107
|
27
|
-
self._id = IDField(
|
28
|
-
label="Stub",
|
29
|
-
placeholder="Stub",
|
30
|
-
hint="Stub",
|
31
|
-
hide=True,
|
32
|
-
disabled=True,
|
33
|
-
)
|
34
26
|
self.fields()
|
35
27
|
self.inject()
|
36
28
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ramifice
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.23
|
4
4
|
Summary: ORM-like API MongoDB for Python language.
|
5
5
|
Project-URL: Homepage, https://github.com/kebasyaty/ramifice
|
6
6
|
Project-URL: Documentation, https://kebasyaty.github.io/ramifice/
|
@@ -142,6 +142,7 @@ from ramifice.migration import Monitor
|
|
142
142
|
@model(service_name="Accounts")
|
143
143
|
class User:
|
144
144
|
def fields(self):
|
145
|
+
# For custom translations.
|
145
146
|
gettext = translations.gettext
|
146
147
|
# ngettext = translations.ngettext
|
147
148
|
self.avatar = ImageField(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
ramifice/__init__.py,sha256=jOSfXKsCkSk7y_mkKMF32gKotkD8V4RmQYvPh4smVVE,679
|
2
2
|
ramifice/add_valid.py,sha256=kvpMg7snL9tor0A23XRdgwiXazRwHfb8baoJUNjM_4Y,327
|
3
|
-
ramifice/decorators.py,sha256=
|
3
|
+
ramifice/decorators.py,sha256=VSAnaD8ZtDzpzNqdTgRKZcYGNm8aJQm9ITChGl4UcEM,6838
|
4
4
|
ramifice/errors.py,sha256=iuhq7fzpUmsOyeXeg2fJjta8yAuqlXLKsZVMpfUhtHE,1901
|
5
5
|
ramifice/fixtures.py,sha256=NtxOnZslYJb4yvRpZbs3ckugmTwHQFS_9iCt2zddOC0,3102
|
6
6
|
ramifice/hooks.py,sha256=Ri-ISfMT-IHaLO2eAqg8CODCTs3HRTxSylqspUKnVf4,873
|
@@ -8,7 +8,7 @@ ramifice/indexing.py,sha256=wQpX2qei5Zc7iIq5yIV93Skp8Aa8ZD0vybnEk7cRuXs,271
|
|
8
8
|
ramifice/migration.py,sha256=t_Rm1OUQYrlaPQQd1uS5S7EYMvSuKUcWzi7P4JMkrOw,11114
|
9
9
|
ramifice/mixins.py,sha256=gKLmWQ-QrGO3K5_k-h1tDa08lkCql_dte2Jy05q1wsM,1125
|
10
10
|
ramifice/model.py,sha256=xhLKosxnT3HkPr6j_BSkB7pvG2WNY_7uylcHo3Oq0vM,6521
|
11
|
-
ramifice/pseudo_model.py,sha256=
|
11
|
+
ramifice/pseudo_model.py,sha256=K00TqtrO6QScfAswM3Rr5Y017PfbtEXHymGSJYYgA40,6744
|
12
12
|
ramifice/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
ramifice/store.py,sha256=MpDEPvUvbs11FXjakNtHPm9MekIv5p1U3as2Y80lTyc,1860
|
14
14
|
ramifice/translations.py,sha256=GNGE0ULAA0aOY5pTxUd3MQW-nVaKvp6BeXWEcsR0s0o,4048
|
@@ -58,7 +58,7 @@ ramifice/fields/general/file_group.py,sha256=n45KfPzFI_l5hXoKkPDG0Q-0mdC2obExV-3
|
|
58
58
|
ramifice/fields/general/number_group.py,sha256=AqlCY-t6JHZ2QVBe7mk5nPt6z8M4VJ_RARRlSBoIxms,715
|
59
59
|
ramifice/fields/general/text_group.py,sha256=gP6mUGXr-LTI1UegqgEMQ-5vtUJuJs0wDYKVkknW_5E,873
|
60
60
|
ramifice/paladins/__init__.py,sha256=PIP3AXI2KBRXNcLJUF0d7ygJ7VLOAxlhb4HRKQ9MGYY,516
|
61
|
-
ramifice/paladins/check.py,sha256=
|
61
|
+
ramifice/paladins/check.py,sha256=h07UX4OKa_1X4Wt3rC-qAAZ8xd-d0rGYlqprXE4CXk0,7009
|
62
62
|
ramifice/paladins/delete.py,sha256=RfCyew5tbBCT8u1c8nMgC2vIQlIWzu9Tvh6TuO7VBmM,3584
|
63
63
|
ramifice/paladins/password.py,sha256=O1OvmeKuXbwtBX1sPTRVsoWYHPQn9isOe1rju6A3wbE,3264
|
64
64
|
ramifice/paladins/refrash.py,sha256=DfBFGjPB6yYjga57GuCiWFBNHalmDO3EfMjkhgoWnVI,1207
|
@@ -76,7 +76,7 @@ ramifice/paladins/groups/num_group.py,sha256=lpyFG9a6WGOzu9f_9jwYVWZNFHxG0B0AVWv
|
|
76
76
|
ramifice/paladins/groups/pass_group.py,sha256=7EXqssszWQaDldJgvyNFFPxj1KSdCN89xFXrfYTTZTQ,1817
|
77
77
|
ramifice/paladins/groups/slug_group.py,sha256=SVYxHcSSgCA51C18LVGxMQYuUw-6ryQlTi6B9T8Dzsw,2185
|
78
78
|
ramifice/paladins/groups/text_group.py,sha256=N_uHsL-JJnNp2JIzNxmNyK9hRupdZGTx9Cbe6muKSmI,3128
|
79
|
-
ramifice-0.3.
|
80
|
-
ramifice-0.3.
|
81
|
-
ramifice-0.3.
|
82
|
-
ramifice-0.3.
|
79
|
+
ramifice-0.3.23.dist-info/METADATA,sha256=yvhJPp8JUOSszvNnN1oZwHJfRunW0sX4b4Xzk_L724Y,18939
|
80
|
+
ramifice-0.3.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
81
|
+
ramifice-0.3.23.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
|
82
|
+
ramifice-0.3.23.dist-info/RECORD,,
|
File without changes
|
File without changes
|