ramifice 0.3.12__py3-none-any.whl → 0.3.13__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/paladins/groups/bool_group.py +4 -0
- ramifice/paladins/groups/choice_group.py +1 -0
- ramifice/paladins/groups/date_group.py +6 -1
- ramifice/paladins/groups/file_group.py +4 -1
- ramifice/paladins/groups/id_group.py +4 -0
- ramifice/paladins/groups/img_group.py +4 -1
- ramifice/paladins/groups/num_group.py +8 -0
- ramifice/paladins/groups/pass_group.py +4 -0
- ramifice/paladins/groups/text_group.py +4 -0
- ramifice/paladins/tools.py +9 -0
- {ramifice-0.3.12.dist-info → ramifice-0.3.13.dist-info}/METADATA +1 -1
- {ramifice-0.3.12.dist-info → ramifice-0.3.13.dist-info}/RECORD +14 -14
- {ramifice-0.3.12.dist-info → ramifice-0.3.13.dist-info}/WHEEL +0 -0
- {ramifice-0.3.12.dist-info → ramifice-0.3.13.dist-info}/licenses/LICENSE +0 -0
@@ -19,6 +19,10 @@ class BoolGroupMixin:
|
|
19
19
|
field = params["field_data"]
|
20
20
|
# Get current value.
|
21
21
|
value = field.value
|
22
|
+
|
23
|
+
if not isinstance(value, (bool, type(None))):
|
24
|
+
self.type_value_error("bool", params) # type: ignore[attr-defined]
|
25
|
+
|
22
26
|
if not params["is_update"] and value is None:
|
23
27
|
value = field.default
|
24
28
|
# Insert result.
|
@@ -4,6 +4,7 @@ Supported fields:
|
|
4
4
|
DateTimeField | DateField
|
5
5
|
"""
|
6
6
|
|
7
|
+
from datetime import datetime
|
7
8
|
from typing import Any
|
8
9
|
|
9
10
|
from babel.dates import format_date, format_datetime
|
@@ -23,6 +24,10 @@ class DateGroupMixin:
|
|
23
24
|
field = params["field_data"]
|
24
25
|
# Get current value.
|
25
26
|
value = field.value or field.default or None
|
27
|
+
|
28
|
+
if not isinstance(value, (datetime, type(None))):
|
29
|
+
self.type_value_error("datetime", params) # type: ignore[attr-defined]
|
30
|
+
|
26
31
|
if value is None:
|
27
32
|
if field.required:
|
28
33
|
err_msg = translations._("Required field !")
|
@@ -30,7 +35,7 @@ class DateGroupMixin:
|
|
30
35
|
if params["is_save"]:
|
31
36
|
params["result_map"][field.name] = None
|
32
37
|
return
|
33
|
-
|
38
|
+
|
34
39
|
# Validation the `max_date` field attribute.
|
35
40
|
max_date = field.max_date
|
36
41
|
if max_date is not None and value > max_date:
|
@@ -20,7 +20,10 @@ class FileGroupMixin:
|
|
20
20
|
"""Checking file fields."""
|
21
21
|
field = params["field_data"]
|
22
22
|
value = field.value or None
|
23
|
-
|
23
|
+
|
24
|
+
if not isinstance(value, (dict, type(None))):
|
25
|
+
self.type_value_error("dict", params) # type: ignore[attr-defined]
|
26
|
+
|
24
27
|
if not params["is_update"]:
|
25
28
|
if value is None:
|
26
29
|
default = field.default or None
|
@@ -23,6 +23,10 @@ class IDGroupMixin:
|
|
23
23
|
field = params["field_data"]
|
24
24
|
# Get current value.
|
25
25
|
value = field.value or None
|
26
|
+
|
27
|
+
if not isinstance(value, (ObjectId, type(None))):
|
28
|
+
self.type_value_error("ObjectId", params) # type: ignore[attr-defined]
|
29
|
+
|
26
30
|
if value is None:
|
27
31
|
if field.required:
|
28
32
|
err_msg = translations._("Required field !")
|
@@ -22,7 +22,10 @@ class ImgGroupMixin:
|
|
22
22
|
"""Checking image fields."""
|
23
23
|
field = params["field_data"]
|
24
24
|
value = field.value or None
|
25
|
-
|
25
|
+
|
26
|
+
if not isinstance(value, (dict, type(None))):
|
27
|
+
self.type_value_error("dict", params) # type: ignore[attr-defined]
|
28
|
+
|
26
29
|
if not params["is_update"]:
|
27
30
|
if value is None:
|
28
31
|
default = field.default or None
|
@@ -23,6 +23,14 @@ class NumGroupMixin:
|
|
23
23
|
value = field.value
|
24
24
|
if value is None:
|
25
25
|
value = field.default
|
26
|
+
|
27
|
+
if "Float" in field.field_type:
|
28
|
+
if not isinstance(value, (float, type(None))):
|
29
|
+
self.type_value_error("float", params) # type: ignore[attr-defined]
|
30
|
+
else:
|
31
|
+
if not isinstance(value, (int, type(None))):
|
32
|
+
self.type_value_error("int", params) # type: ignore[attr-defined]
|
33
|
+
|
26
34
|
if value is None:
|
27
35
|
if field.required:
|
28
36
|
err_msg = translations._("Required field !")
|
@@ -25,6 +25,10 @@ class PassGroupMixin:
|
|
25
25
|
return
|
26
26
|
# Get current value.
|
27
27
|
value = field.value or None
|
28
|
+
|
29
|
+
if not isinstance(value, (str, type(None))):
|
30
|
+
self.type_value_error("str", params) # type: ignore[attr-defined]
|
31
|
+
|
28
32
|
if value is None:
|
29
33
|
if field.required:
|
30
34
|
err_msg = translations._("Required field !")
|
@@ -25,6 +25,10 @@ class TextGroupMixin:
|
|
25
25
|
field = params["field_data"]
|
26
26
|
# Get current value.
|
27
27
|
value = field.value or field.default or None
|
28
|
+
|
29
|
+
if not isinstance(value, (str, type(None))):
|
30
|
+
self.type_value_error("str", params) # type: ignore[attr-defined]
|
31
|
+
|
28
32
|
if value is None:
|
29
33
|
if field.required:
|
30
34
|
err_msg = translations._("Required field !")
|
ramifice/paladins/tools.py
CHANGED
@@ -62,6 +62,15 @@ class ToolMixin:
|
|
62
62
|
)
|
63
63
|
raise PanicError(msg)
|
64
64
|
|
65
|
+
def type_value_error(self, value_type: str, params: dict[str, Any]) -> None:
|
66
|
+
"""Unacceptable type of value."""
|
67
|
+
msg = (
|
68
|
+
f"Model: `{self.full_model_name()}` > " # type: ignore[attr-defined]
|
69
|
+
+ f"Field: `{params['field_data'].name}` > "
|
70
|
+
+ f"Parameter: `value` => Must be `{value_type}` type!"
|
71
|
+
)
|
72
|
+
raise PanicError(msg)
|
73
|
+
|
65
74
|
async def check_uniqueness(
|
66
75
|
self,
|
67
76
|
value: str | int | float | datetime,
|
@@ -62,19 +62,19 @@ ramifice/paladins/delete.py,sha256=EFhr5yJDrvv1Sy3Z_x5gYjuMCDLuSYlRFdPDkvOFhgg,3
|
|
62
62
|
ramifice/paladins/password.py,sha256=O1OvmeKuXbwtBX1sPTRVsoWYHPQn9isOe1rju6A3wbE,3264
|
63
63
|
ramifice/paladins/refrash.py,sha256=bfVmpyxlDIY2ASOd-BnCWTnlMO7tbYvN-A83CaR_73s,1193
|
64
64
|
ramifice/paladins/save.py,sha256=IeVBc3aLpJsdxNOS_O5GrnACZftWdbVP8qVpsd7pD1Y,3549
|
65
|
-
ramifice/paladins/tools.py,sha256=
|
65
|
+
ramifice/paladins/tools.py,sha256=KCY0RMCPrqNAFxA073NBOkTUyrkor8Cb1ZhX0G0apt8,4036
|
66
66
|
ramifice/paladins/groups/__init__.py,sha256=hpqmWLsYAMvZHAbmMXluQSqLhkHOSTUAgLHyTM1LTYI,472
|
67
|
-
ramifice/paladins/groups/bool_group.py,sha256=
|
68
|
-
ramifice/paladins/groups/choice_group.py,sha256=
|
69
|
-
ramifice/paladins/groups/date_group.py,sha256=
|
70
|
-
ramifice/paladins/groups/file_group.py,sha256=
|
71
|
-
ramifice/paladins/groups/id_group.py,sha256=
|
72
|
-
ramifice/paladins/groups/img_group.py,sha256=
|
73
|
-
ramifice/paladins/groups/num_group.py,sha256=
|
74
|
-
ramifice/paladins/groups/pass_group.py,sha256=
|
67
|
+
ramifice/paladins/groups/bool_group.py,sha256=y6HnnnP9YpcE6vuDeaKPGimAxJVNx8Gj5bMyvl2Hli0,780
|
68
|
+
ramifice/paladins/groups/choice_group.py,sha256=Wa60SLiF8AdFAKC1eYdqaAb-ZuO1ICAia8If0oXTx-U,1755
|
69
|
+
ramifice/paladins/groups/date_group.py,sha256=JhF9JXJ9JPQrF6ndAGQ0AnejVHqBBQoKa7fglzQd8_A,3813
|
70
|
+
ramifice/paladins/groups/file_group.py,sha256=jWuYNskE6x0CxQbSTBay4padSiHnDCnJ-2UGFqvNQzM,3263
|
71
|
+
ramifice/paladins/groups/id_group.py,sha256=zWZXcYCbq8dvvplG0Zz3xw7P5AKmYMwWZIcTSL4uLU4,1313
|
72
|
+
ramifice/paladins/groups/img_group.py,sha256=13LkIWSHCrW-mtXrp3Tcc649npV9JoKV9_a1r8gmgtQ,5744
|
73
|
+
ramifice/paladins/groups/num_group.py,sha256=Ak7JLO6FKI3Viq1p9NIZaJk0PHikQnU_JDdzsPLMPuE,2381
|
74
|
+
ramifice/paladins/groups/pass_group.py,sha256=_2QG80cqVKAYVj_ONzpBA-ksbUjY0n9MArjE7hxGxsI,1929
|
75
75
|
ramifice/paladins/groups/slug_group.py,sha256=AhTODxabYTWC41Xssnp9gqklUz9-GBS0lWyeHLXOYmw,1652
|
76
|
-
ramifice/paladins/groups/text_group.py,sha256=
|
77
|
-
ramifice-0.3.
|
78
|
-
ramifice-0.3.
|
79
|
-
ramifice-0.3.
|
80
|
-
ramifice-0.3.
|
76
|
+
ramifice/paladins/groups/text_group.py,sha256=BDfg9mmXgZUhuIUofnYel1Gf4ltGv-_SlWY9xObRzok,3397
|
77
|
+
ramifice-0.3.13.dist-info/METADATA,sha256=a5KyZ2Uk6NxmUIg3ox5cElKacKCaenES6kieWH6NsQk,14182
|
78
|
+
ramifice-0.3.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
79
|
+
ramifice-0.3.13.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
|
80
|
+
ramifice-0.3.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|