ramifice 0.3.21__py3-none-any.whl → 0.3.22__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/__init__.py +2 -2
- ramifice/decorators.py +10 -3
- ramifice/paladins/check.py +4 -2
- ramifice/paladins/groups/bool_group.py +1 -1
- ramifice/paladins/groups/choice_group.py +2 -2
- ramifice/paladins/groups/date_group.py +4 -4
- ramifice/paladins/groups/file_group.py +4 -4
- ramifice/paladins/groups/id_group.py +4 -4
- ramifice/paladins/groups/img_group.py +4 -4
- ramifice/paladins/groups/num_group.py +7 -11
- ramifice/paladins/groups/pass_group.py +5 -5
- ramifice/paladins/groups/slug_group.py +1 -5
- ramifice/paladins/groups/text_group.py +10 -14
- ramifice/paladins/tools.py +5 -8
- ramifice/pseudo_model.py +19 -13
- {ramifice-0.3.21.dist-info → ramifice-0.3.22.dist-info}/METADATA +1 -1
- {ramifice-0.3.21.dist-info → ramifice-0.3.22.dist-info}/RECORD +19 -19
- {ramifice-0.3.21.dist-info → ramifice-0.3.22.dist-info}/WHEEL +0 -0
- {ramifice-0.3.21.dist-info → ramifice-0.3.22.dist-info}/licenses/LICENSE +0 -0
ramifice/__init__.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2022-present MongoDB, Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
ramifice/decorators.py
CHANGED
@@ -122,7 +122,7 @@ def caching(cls: Any, service_name: str, is_migrate_model: bool) -> dict[str, An
|
|
122
122
|
# Count all fields.
|
123
123
|
count_all_fields = 0
|
124
124
|
# Count fields for migrating.
|
125
|
-
|
125
|
+
count_fields_no_ignored = 0
|
126
126
|
|
127
127
|
raw_model = cls()
|
128
128
|
raw_model.fields()
|
@@ -145,17 +145,24 @@ def caching(cls: Any, service_name: str, is_migrate_model: bool) -> dict[str, An
|
|
145
145
|
if not f_type.ignored:
|
146
146
|
# Count fields for migrating.
|
147
147
|
if is_migrate_model:
|
148
|
-
|
148
|
+
count_fields_no_ignored += 1
|
149
149
|
# Get a dictionary of field names and types.
|
150
150
|
field_name_and_type[f_name] = f_type_str
|
151
151
|
# Build data migration storage for dynamic fields.
|
152
152
|
if "Dyn" in f_type.field_type:
|
153
|
+
if not is_migrate_model:
|
154
|
+
msg = (
|
155
|
+
f"Model: `{cls.__module__}.{model_name}` > "
|
156
|
+
+ f"Field: `{f_name}` => "
|
157
|
+
+ "Dynamic field only for a migrated Model."
|
158
|
+
)
|
159
|
+
raise PanicError(msg)
|
153
160
|
data_dynamic_fields[f_name] = None
|
154
161
|
|
155
162
|
metadata["field_name_and_type"] = field_name_and_type
|
156
163
|
metadata["field_attrs"] = field_attrs
|
157
164
|
metadata["data_dynamic_fields"] = data_dynamic_fields
|
158
165
|
metadata["count_all_fields"] = count_all_fields
|
159
|
-
metadata["
|
166
|
+
metadata["count_fields_no_ignored"] = count_fields_no_ignored
|
160
167
|
|
161
168
|
return metadata
|
ramifice/paladins/check.py
CHANGED
@@ -45,11 +45,12 @@ class CheckMixin(
|
|
45
45
|
It is also used to verify Models that do not migrate to the database.
|
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
|
+
if not is_migrate_model and is_save:
|
49
50
|
msg = (
|
50
51
|
f"Model: `{self.full_model_name()}` > " # type: ignore[attr-defined]
|
51
52
|
+ "Method: `check` => "
|
52
|
-
+ "For a non-migrating Model, the `is_save` parameter
|
53
|
+
+ "For a non -migrating Model, the `is_save` parameter must be equal to` False` !"
|
53
54
|
)
|
54
55
|
raise PanicError(msg)
|
55
56
|
# Get the document ID.
|
@@ -78,6 +79,7 @@ class CheckMixin(
|
|
78
79
|
"collection": collection,
|
79
80
|
"field_data": None,
|
80
81
|
"full_model_name": cls_model.META["full_model_name"], # type: ignore[attr-defined]
|
82
|
+
"is_migrate_model": is_migrate_model,
|
81
83
|
}
|
82
84
|
#
|
83
85
|
# Run checking fields.
|
@@ -23,7 +23,7 @@ class BoolGroupMixin:
|
|
23
23
|
value = field.value
|
24
24
|
|
25
25
|
if not isinstance(value, (bool, type(None))):
|
26
|
-
panic_type_error(
|
26
|
+
panic_type_error("bool | None", params)
|
27
27
|
|
28
28
|
if not params["is_update"] and value is None:
|
29
29
|
value = field.default
|
@@ -32,14 +32,14 @@ class ChoiceGroupMixin:
|
|
32
32
|
if value is None:
|
33
33
|
if field.required:
|
34
34
|
err_msg = translations._("Required field !")
|
35
|
-
accumulate_error(
|
35
|
+
accumulate_error(err_msg, params)
|
36
36
|
if params["is_save"]:
|
37
37
|
params["result_map"][field.name] = None
|
38
38
|
return
|
39
39
|
# Does the field value match the possible options in choices.
|
40
40
|
if not field.has_value():
|
41
41
|
err_msg = translations._("Your choice does not match the options offered !")
|
42
|
-
accumulate_error(
|
42
|
+
accumulate_error(err_msg, params)
|
43
43
|
# Insert result.
|
44
44
|
if params["is_save"]:
|
45
45
|
params["result_map"][field.name] = value
|
@@ -27,12 +27,12 @@ class DateGroupMixin:
|
|
27
27
|
value = field.value or field.default or None
|
28
28
|
|
29
29
|
if not isinstance(value, (datetime, type(None))):
|
30
|
-
panic_type_error(
|
30
|
+
panic_type_error("datetime | None", params)
|
31
31
|
|
32
32
|
if value is None:
|
33
33
|
if field.required:
|
34
34
|
err_msg = translations._("Required field !")
|
35
|
-
accumulate_error(
|
35
|
+
accumulate_error(err_msg, params)
|
36
36
|
if params["is_save"]:
|
37
37
|
params["result_map"][field.name] = None
|
38
38
|
return
|
@@ -70,7 +70,7 @@ class DateGroupMixin:
|
|
70
70
|
"The date %s must not be greater than max=%s !" % value_str,
|
71
71
|
max_date_str,
|
72
72
|
)
|
73
|
-
accumulate_error(
|
73
|
+
accumulate_error(err_msg, params)
|
74
74
|
# Validation the `min_date` field attribute.
|
75
75
|
min_date = field.min_date
|
76
76
|
if min_date is not None and value < min_date:
|
@@ -103,7 +103,7 @@ class DateGroupMixin:
|
|
103
103
|
err_msg = translations._(
|
104
104
|
"The date %s must not be less than min=%s !" % value_str, min_date_str
|
105
105
|
)
|
106
|
-
accumulate_error(
|
106
|
+
accumulate_error(err_msg, params)
|
107
107
|
# Insert result.
|
108
108
|
if params["is_save"]:
|
109
109
|
params["result_map"][field.name] = value
|
@@ -22,7 +22,7 @@ class FileGroupMixin:
|
|
22
22
|
value = field.value or None
|
23
23
|
|
24
24
|
if not isinstance(value, (dict, type(None))):
|
25
|
-
panic_type_error(
|
25
|
+
panic_type_error("dict | None", params)
|
26
26
|
|
27
27
|
if not params["is_update"]:
|
28
28
|
if value is None:
|
@@ -36,7 +36,7 @@ class FileGroupMixin:
|
|
36
36
|
if value is None:
|
37
37
|
if field.required:
|
38
38
|
err_msg = translations._("Required field !")
|
39
|
-
accumulate_error(
|
39
|
+
accumulate_error(err_msg, params)
|
40
40
|
if params["is_save"]:
|
41
41
|
params["result_map"][field.name] = None
|
42
42
|
return
|
@@ -57,14 +57,14 @@ class FileGroupMixin:
|
|
57
57
|
params["result_map"][field.name] = None
|
58
58
|
else:
|
59
59
|
err_msg = translations._("Required field !")
|
60
|
-
accumulate_error(
|
60
|
+
accumulate_error(err_msg, params)
|
61
61
|
return
|
62
62
|
# Accumulate an error if the file size exceeds the maximum value.
|
63
63
|
if value["size"] > field.max_size:
|
64
64
|
err_msg = translations._(
|
65
65
|
"File size exceeds the maximum value %s !" % to_human_size(field.max_size)
|
66
66
|
)
|
67
|
-
accumulate_error(
|
67
|
+
accumulate_error(err_msg, params)
|
68
68
|
return
|
69
69
|
# Insert result.
|
70
70
|
if params["is_save"] and (value["is_new_file"] or value["save_as_is"]):
|
@@ -23,22 +23,22 @@ class IDGroupMixin:
|
|
23
23
|
"""Checking id fields."""
|
24
24
|
field = params["field_data"]
|
25
25
|
# Get current value.
|
26
|
-
value = field.value
|
26
|
+
value = field.value
|
27
27
|
|
28
28
|
if not isinstance(value, (ObjectId, type(None))):
|
29
|
-
panic_type_error(
|
29
|
+
panic_type_error("ObjectId | None", params)
|
30
30
|
|
31
31
|
if value is None:
|
32
32
|
if field.required:
|
33
33
|
err_msg = translations._("Required field !")
|
34
|
-
accumulate_error(
|
34
|
+
accumulate_error(err_msg, params)
|
35
35
|
if params["is_save"]:
|
36
36
|
params["result_map"][field.name] = None
|
37
37
|
return
|
38
38
|
# Validation of the MongoDB identifier in a string form.
|
39
39
|
if not ObjectId.is_valid(value):
|
40
40
|
err_msg = translations._("Invalid document ID !")
|
41
|
-
accumulate_error(
|
41
|
+
accumulate_error(err_msg, params)
|
42
42
|
# Insert result.
|
43
43
|
if params["is_save"]:
|
44
44
|
params["result_map"][field.name] = value
|
@@ -24,7 +24,7 @@ class ImgGroupMixin:
|
|
24
24
|
value = field.value or None
|
25
25
|
|
26
26
|
if not isinstance(value, (dict, type(None))):
|
27
|
-
panic_type_error(
|
27
|
+
panic_type_error("dict | None", params)
|
28
28
|
|
29
29
|
if not params["is_update"]:
|
30
30
|
if value is None:
|
@@ -38,7 +38,7 @@ class ImgGroupMixin:
|
|
38
38
|
if value is None:
|
39
39
|
if field.required:
|
40
40
|
err_msg = translations._("Required field !")
|
41
|
-
accumulate_error(
|
41
|
+
accumulate_error(err_msg, params)
|
42
42
|
if params["is_save"]:
|
43
43
|
params["result_map"][field.name] = None
|
44
44
|
return
|
@@ -59,14 +59,14 @@ class ImgGroupMixin:
|
|
59
59
|
params["result_map"][field.name] = None
|
60
60
|
else:
|
61
61
|
err_msg = translations._("Required field !")
|
62
|
-
accumulate_error(
|
62
|
+
accumulate_error(err_msg, params)
|
63
63
|
return
|
64
64
|
# Accumulate an error if the file size exceeds the maximum value.
|
65
65
|
if value["size"] > field.max_size:
|
66
66
|
err_msg = translations._(
|
67
67
|
"Image size exceeds the maximum value %s !" % to_human_size(field.max_size)
|
68
68
|
)
|
69
|
-
accumulate_error(
|
69
|
+
accumulate_error(err_msg, params)
|
70
70
|
return
|
71
71
|
# Create thumbnails.
|
72
72
|
if value["is_new_img"]:
|
@@ -27,15 +27,15 @@ class NumGroupMixin:
|
|
27
27
|
|
28
28
|
if "Float" in field.field_type:
|
29
29
|
if not isinstance(value, (float, type(None))):
|
30
|
-
panic_type_error(
|
30
|
+
panic_type_error("float | None", params)
|
31
31
|
else:
|
32
32
|
if not isinstance(value, (int, type(None))):
|
33
|
-
panic_type_error(
|
33
|
+
panic_type_error("int | None", params)
|
34
34
|
|
35
35
|
if value is None:
|
36
36
|
if field.required:
|
37
37
|
err_msg = translations._("Required field !")
|
38
|
-
accumulate_error(
|
38
|
+
accumulate_error(err_msg, params)
|
39
39
|
if params["is_save"]:
|
40
40
|
params["result_map"][field.name] = None
|
41
41
|
return
|
@@ -45,22 +45,18 @@ class NumGroupMixin:
|
|
45
45
|
err_msg = translations._(
|
46
46
|
"The value %d must not be greater than max=%d !" % value, max_number
|
47
47
|
)
|
48
|
-
accumulate_error(
|
48
|
+
accumulate_error(err_msg, params)
|
49
49
|
# Validation the `min_number` field attribute.
|
50
50
|
min_number = field.min_number
|
51
51
|
if min_number is not None and value < min_number:
|
52
52
|
err_msg = translations._(
|
53
53
|
"The value %d must not be less than min=%d !" % value, min_number
|
54
54
|
)
|
55
|
-
accumulate_error(
|
55
|
+
accumulate_error(err_msg, params)
|
56
56
|
# Validation the `unique` field attribute.
|
57
|
-
if field.unique and not await check_uniqueness(
|
58
|
-
self.__class__.META["is_migrate_model"], # type: ignore[attr-defined]
|
59
|
-
value,
|
60
|
-
params,
|
61
|
-
):
|
57
|
+
if field.unique and not await check_uniqueness(value, params):
|
62
58
|
err_msg = translations._("Is not unique !")
|
63
|
-
accumulate_error(
|
59
|
+
accumulate_error(err_msg, params)
|
64
60
|
# Insert result.
|
65
61
|
if params["is_save"]:
|
66
62
|
params["result_map"][field.name] = value
|
@@ -28,24 +28,24 @@ class PassGroupMixin:
|
|
28
28
|
value = field.value or None
|
29
29
|
|
30
30
|
if not isinstance(value, (str, type(None))):
|
31
|
-
panic_type_error(
|
31
|
+
panic_type_error("str | None", params)
|
32
32
|
|
33
33
|
if value is None:
|
34
34
|
if field.required:
|
35
35
|
err_msg = translations._("Required field !")
|
36
|
-
accumulate_error(
|
36
|
+
accumulate_error(err_msg, params)
|
37
37
|
if params["is_save"]:
|
38
38
|
params["result_map"][field.name] = None
|
39
39
|
return
|
40
40
|
# Validation Passwor.
|
41
41
|
if not field.is_valid(value):
|
42
42
|
err_msg = translations._("Invalid Password !")
|
43
|
-
accumulate_error(
|
43
|
+
accumulate_error(err_msg, params)
|
44
44
|
chars = "a-z A-Z 0-9 - . _ ! \" ` ' # % & , : ; < > = @ { } ~ $ ( ) * + / \\ ? [ ] ^ |"
|
45
45
|
err_msg = translations._("Valid characters: %s" % chars)
|
46
|
-
accumulate_error(
|
46
|
+
accumulate_error(err_msg, params)
|
47
47
|
err_msg = translations._("Number of characters: from 8 to 256")
|
48
|
-
accumulate_error(
|
48
|
+
accumulate_error(err_msg, params)
|
49
49
|
# Insert result.
|
50
50
|
if params["is_save"]:
|
51
51
|
ph = PasswordHasher()
|
@@ -51,11 +51,7 @@ class SlugGroupMixin:
|
|
51
51
|
# Convert to slug.
|
52
52
|
value = slugify("-".join(raw_str_list))
|
53
53
|
# Validation of uniqueness of the value.
|
54
|
-
if not await check_uniqueness(
|
55
|
-
self.__class__.META["is_migrate_model"], # type: ignore[attr-defined]
|
56
|
-
value,
|
57
|
-
params,
|
58
|
-
):
|
54
|
+
if not await check_uniqueness(value, params):
|
59
55
|
err_msg = (
|
60
56
|
f"Model: `{params['full_model_name']}` > "
|
61
57
|
+ f"Field: `{field.name}` > "
|
@@ -28,12 +28,12 @@ class TextGroupMixin:
|
|
28
28
|
value = field.value or field.default or None
|
29
29
|
|
30
30
|
if not isinstance(value, (str, type(None))):
|
31
|
-
panic_type_error(
|
31
|
+
panic_type_error("str | None", params)
|
32
32
|
|
33
33
|
if value is None:
|
34
34
|
if field.required:
|
35
35
|
err_msg = translations._("Required field !")
|
36
|
-
accumulate_error(
|
36
|
+
accumulate_error(err_msg, params)
|
37
37
|
if params["is_save"]:
|
38
38
|
params["result_map"][field.name] = None
|
39
39
|
return
|
@@ -41,15 +41,11 @@ class TextGroupMixin:
|
|
41
41
|
maxlength: int | None = field.__dict__.get("maxlength")
|
42
42
|
if maxlength is not None and len(value) > maxlength:
|
43
43
|
err_msg = translations._("The length of the string exceeds maxlength=%d !" % maxlength)
|
44
|
-
accumulate_error(
|
44
|
+
accumulate_error(err_msg, params)
|
45
45
|
# Validation the `unique` field attribute.
|
46
|
-
if field.unique and not await check_uniqueness(
|
47
|
-
self.__class__.META["is_migrate_model"], # type: ignore[attr-defined]
|
48
|
-
value,
|
49
|
-
params,
|
50
|
-
):
|
46
|
+
if field.unique and not await check_uniqueness(value, params):
|
51
47
|
err_msg = translations._("Is not unique !")
|
52
|
-
accumulate_error(
|
48
|
+
accumulate_error(err_msg, params)
|
53
49
|
# Validation Email, Url, IP, Color, Phone.
|
54
50
|
field_type = field.field_type
|
55
51
|
if "Email" in field_type:
|
@@ -62,19 +58,19 @@ class TextGroupMixin:
|
|
62
58
|
params["field_data"].value = value
|
63
59
|
except EmailNotValidError:
|
64
60
|
err_msg = translations._("Invalid Email address !")
|
65
|
-
accumulate_error(
|
61
|
+
accumulate_error(err_msg, params)
|
66
62
|
elif "URL" in field_type and not field.is_valid(value):
|
67
63
|
err_msg = translations._("Invalid URL address !")
|
68
|
-
accumulate_error(
|
64
|
+
accumulate_error(err_msg, params)
|
69
65
|
elif "IP" in field_type and not field.is_valid(value):
|
70
66
|
err_msg = translations._("Invalid IP address !")
|
71
|
-
accumulate_error(
|
67
|
+
accumulate_error(err_msg, params)
|
72
68
|
elif "Color" in field_type and not field.is_valid(value):
|
73
69
|
err_msg = translations._("Invalid Color code !")
|
74
|
-
accumulate_error(
|
70
|
+
accumulate_error(err_msg, params)
|
75
71
|
elif "Phone" in field_type and not field.is_valid(value):
|
76
72
|
err_msg = translations._("Invalid Phone number !")
|
77
|
-
accumulate_error(
|
73
|
+
accumulate_error(err_msg, params)
|
78
74
|
# Insert result.
|
79
75
|
if params["is_save"]:
|
80
76
|
params["result_map"][field.name] = value
|
ramifice/paladins/tools.py
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
from typing import Any
|
4
4
|
|
5
|
-
from termcolor import colored
|
6
|
-
|
7
5
|
from ..errors import PanicError
|
8
6
|
|
9
7
|
|
@@ -21,17 +19,17 @@ def refresh_from_mongo_doc(inst_model: Any, mongo_doc: dict[str, Any]) -> None:
|
|
21
19
|
field.value = data if field.group != "pass" else None
|
22
20
|
|
23
21
|
|
24
|
-
def panic_type_error(
|
22
|
+
def panic_type_error(value_type: str, params: dict[str, Any]) -> None:
|
25
23
|
"""Unacceptable type of value."""
|
26
24
|
msg = (
|
27
|
-
f"Model: `{
|
25
|
+
f"Model: `{params['full_model_name']}` > "
|
28
26
|
+ f"Field: `{params['field_data'].name}` > "
|
29
27
|
+ f"Parameter: `value` => Must be `{value_type}` type!"
|
30
28
|
)
|
31
29
|
raise PanicError(msg)
|
32
30
|
|
33
31
|
|
34
|
-
def accumulate_error(
|
32
|
+
def accumulate_error(err_msg: str, params: dict[str, Any]) -> None:
|
35
33
|
"""For accumulating errors to ModelName.field_name.errors ."""
|
36
34
|
if not params["field_data"].hide:
|
37
35
|
params["field_data"].errors.append(err_msg)
|
@@ -39,7 +37,7 @@ def accumulate_error(model_name: str, err_msg: str, params: dict[str, Any]) -> N
|
|
39
37
|
params["is_error_symptom"] = True
|
40
38
|
else:
|
41
39
|
msg = (
|
42
|
-
f">>hidden field<< -> Model: `{
|
40
|
+
f">>hidden field<< -> Model: `{params['full_model_name']}` > "
|
43
41
|
+ f"Field: `{params['field_data'].name}`"
|
44
42
|
+ f" => {err_msg}"
|
45
43
|
)
|
@@ -47,12 +45,11 @@ def accumulate_error(model_name: str, err_msg: str, params: dict[str, Any]) -> N
|
|
47
45
|
|
48
46
|
|
49
47
|
async def check_uniqueness(
|
50
|
-
is_migrate_model: bool,
|
51
48
|
value: str | int | float,
|
52
49
|
params: dict[str, Any],
|
53
50
|
) -> bool:
|
54
51
|
"""Check the uniqueness of the value in the collection."""
|
55
|
-
if not is_migrate_model:
|
52
|
+
if not params["is_migrate_model"]:
|
56
53
|
return True
|
57
54
|
q_filter = {
|
58
55
|
"$and": [
|
ramifice/pseudo_model.py
CHANGED
@@ -11,6 +11,7 @@ from bson.objectid import ObjectId
|
|
11
11
|
from dateutil.parser import parse
|
12
12
|
|
13
13
|
from . import translations
|
14
|
+
from .errors import PanicError
|
14
15
|
from .fields import IDField # type: ignore[attr-defined]
|
15
16
|
|
16
17
|
|
@@ -32,19 +33,19 @@ class PseudoModel(metaclass=ABCMeta):
|
|
32
33
|
)
|
33
34
|
self.fields()
|
34
35
|
self.inject()
|
36
|
+
|
35
37
|
for _, f_type in self.__dict__.items():
|
36
|
-
if not callable(f_type):
|
37
|
-
|
38
|
-
f_type.__dict__["add_width_height"] = True
|
38
|
+
if not callable(f_type) and f_type.group == "img":
|
39
|
+
f_type.__dict__["add_width_height"] = True
|
39
40
|
|
40
41
|
def __del__(self) -> None: # noqa: D105
|
41
42
|
# If the model is not migrated,
|
42
43
|
# it must delete files and images in the destructor.
|
43
44
|
for _, f_type in self.__dict__.items():
|
44
|
-
if
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
if callable(f_type):
|
46
|
+
continue
|
47
|
+
value = f_type.value
|
48
|
+
if value is not None:
|
48
49
|
if f_type.group == "file":
|
49
50
|
value = value.get("path")
|
50
51
|
if value is not None:
|
@@ -73,13 +74,18 @@ class PseudoModel(metaclass=ABCMeta):
|
|
73
74
|
metadata = self.__class__.META
|
74
75
|
if bool(metadata):
|
75
76
|
field_attrs = metadata["field_attrs"]
|
76
|
-
data_dynamic_fields = metadata["data_dynamic_fields"]
|
77
77
|
for f_name, f_type in self.__dict__.items():
|
78
|
-
if
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
if callable(f_type):
|
79
|
+
continue
|
80
|
+
f_type.id = field_attrs[f_name]["id"]
|
81
|
+
f_type.name = field_attrs[f_name]["name"]
|
82
|
+
if "Dyn" in f_type.field_type:
|
83
|
+
msg = (
|
84
|
+
f"Model: `{metadata['full_model_name']}` > "
|
85
|
+
+ f"Field: `{f_name}` => "
|
86
|
+
+ "Dynamic field only for a migrated Model."
|
87
|
+
)
|
88
|
+
raise PanicError(msg)
|
83
89
|
|
84
90
|
# Complect of methods for converting Model to JSON and back.
|
85
91
|
# --------------------------------------------------------------------------
|
@@ -1,6 +1,6 @@
|
|
1
|
-
ramifice/__init__.py,sha256=
|
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=0_KKq2u7mX12iqWp4-vfGBR4cKqfkey7gL5P9C7bBNQ,6811
|
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=D2eW6gYDKxSLOXyyeIOyP2k84vsaISGXytBHoiLwRdU,6981
|
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,25 +58,25 @@ 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=W1eJRWxcaoKIFawJOF8rshy2-SKSPPuKXms9rxN7y64,6938
|
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
|
65
65
|
ramifice/paladins/save.py,sha256=7KxocEisEVYWkZtBpHZyP6drGMyOVvF2vaymm4HNHmg,4276
|
66
|
-
ramifice/paladins/tools.py,sha256=
|
66
|
+
ramifice/paladins/tools.py,sha256=9RDjyRJ5j8E5jNxVYHx-L87hCxqpu9WadycGSz7LZY0,2038
|
67
67
|
ramifice/paladins/validation.py,sha256=7lFDWjokUwMwVxWAVgd_GlWGpF4mukxIVpxvpdyA19A,1850
|
68
68
|
ramifice/paladins/groups/__init__.py,sha256=hpqmWLsYAMvZHAbmMXluQSqLhkHOSTUAgLHyTM1LTYI,472
|
69
|
-
ramifice/paladins/groups/bool_group.py,sha256=
|
70
|
-
ramifice/paladins/groups/choice_group.py,sha256=
|
71
|
-
ramifice/paladins/groups/date_group.py,sha256
|
72
|
-
ramifice/paladins/groups/file_group.py,sha256=
|
73
|
-
ramifice/paladins/groups/id_group.py,sha256=
|
74
|
-
ramifice/paladins/groups/img_group.py,sha256=
|
75
|
-
ramifice/paladins/groups/num_group.py,sha256=
|
76
|
-
ramifice/paladins/groups/pass_group.py,sha256=
|
77
|
-
ramifice/paladins/groups/slug_group.py,sha256=
|
78
|
-
ramifice/paladins/groups/text_group.py,sha256=
|
79
|
-
ramifice-0.3.
|
80
|
-
ramifice-0.3.
|
81
|
-
ramifice-0.3.
|
82
|
-
ramifice-0.3.
|
69
|
+
ramifice/paladins/groups/bool_group.py,sha256=oJc9mw9KGrnK_Pj7uXixYYQAJphcXLr_xSQv3PMUlcU,792
|
70
|
+
ramifice/paladins/groups/choice_group.py,sha256=ZV6t6qgh__BzWGRUSx2RdXH_K9BtBOo0eAZ3Yon0tfY,1723
|
71
|
+
ramifice/paladins/groups/date_group.py,sha256=bVhzmwsN3sKbmzvm4jI0i_Mzjwn8gdx4kxCUWq-0Yqs,3736
|
72
|
+
ramifice/paladins/groups/file_group.py,sha256=AtGu2sQ9A64dPo2Kpt4milp5HWPdULdPdQycwFW8ZgE,2925
|
73
|
+
ramifice/paladins/groups/id_group.py,sha256=zAlJrDTOdRY9e7eFYSXPjjsD05A4EsgSE6ibN3KKOMU,1263
|
74
|
+
ramifice/paladins/groups/img_group.py,sha256=o0bMI1WIA6t1QrhLaR2bBAAJUKCgHg7SiIFQsGTr2Cg,5535
|
75
|
+
ramifice/paladins/groups/num_group.py,sha256=lpyFG9a6WGOzu9f_9jwYVWZNFHxG0B0AVWvvbv_2mV0,2224
|
76
|
+
ramifice/paladins/groups/pass_group.py,sha256=7EXqssszWQaDldJgvyNFFPxj1KSdCN89xFXrfYTTZTQ,1817
|
77
|
+
ramifice/paladins/groups/slug_group.py,sha256=SVYxHcSSgCA51C18LVGxMQYuUw-6ryQlTi6B9T8Dzsw,2185
|
78
|
+
ramifice/paladins/groups/text_group.py,sha256=N_uHsL-JJnNp2JIzNxmNyK9hRupdZGTx9Cbe6muKSmI,3128
|
79
|
+
ramifice-0.3.22.dist-info/METADATA,sha256=YpuZPDu3wd9tubh_VDZdCSVQbl_aEaq1kZPjYqA_isU,18904
|
80
|
+
ramifice-0.3.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
81
|
+
ramifice-0.3.22.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
|
82
|
+
ramifice-0.3.22.dist-info/RECORD,,
|
File without changes
|
File without changes
|