ramifice 0.5.3__py3-none-any.whl → 0.5.5__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/commons/unit_manager.py +36 -27
- ramifice/fields/choice_float_dyn_field.py +2 -2
- ramifice/fields/choice_float_field.py +9 -4
- ramifice/fields/choice_float_mult_dyn_field.py +2 -2
- ramifice/fields/choice_float_mult_field.py +4 -4
- ramifice/fields/choice_int_dyn_field.py +2 -2
- ramifice/fields/choice_int_field.py +9 -4
- ramifice/fields/choice_int_mult_dyn_field.py +2 -2
- ramifice/fields/choice_int_mult_field.py +4 -4
- ramifice/fields/choice_text_dyn_field.py +2 -2
- ramifice/fields/choice_text_field.py +9 -4
- ramifice/fields/choice_text_mult_dyn_field.py +2 -2
- ramifice/fields/choice_text_mult_field.py +4 -4
- ramifice/models/model.py +3 -3
- ramifice/utils/migration.py +1 -1
- ramifice/utils/unit.py +6 -14
- {ramifice-0.5.3.dist-info → ramifice-0.5.5.dist-info}/METADATA +2 -2
- {ramifice-0.5.3.dist-info → ramifice-0.5.5.dist-info}/RECORD +20 -20
- {ramifice-0.5.3.dist-info → ramifice-0.5.5.dist-info}/WHEEL +0 -0
- {ramifice-0.5.3.dist-info → ramifice-0.5.5.dist-info}/licenses/LICENSE +0 -0
ramifice/commons/unit_manager.py
CHANGED
@@ -34,59 +34,68 @@ class UnitMixin:
|
|
34
34
|
# Check the presence of a Model state.
|
35
35
|
if model_state is None:
|
36
36
|
raise PanicError("Error: Model State - Not found!")
|
37
|
-
# Get
|
38
|
-
|
39
|
-
# Get
|
37
|
+
# Get language list.
|
38
|
+
lang_list = translations.LANGUAGES
|
39
|
+
# Get clean fields of Unit.
|
40
|
+
unit_field: str = unit.field
|
40
41
|
title = unit.title
|
41
|
-
title
|
42
|
-
|
43
|
-
|
42
|
+
if len(title) != len(lang_list):
|
43
|
+
raise PanicError("Unit.title => There are no translations for some languages!")
|
44
|
+
title = {lang: title[lang] for lang in lang_list}
|
45
|
+
target_value = unit.value
|
46
|
+
# Get dynamic field data.
|
47
|
+
choices: list | None = model_state["data_dynamic_fields"][unit_field]
|
48
|
+
# Determine the presence of unit.
|
49
|
+
is_unit_exists: bool = False
|
50
|
+
if choices is not None:
|
51
|
+
for item in choices:
|
52
|
+
if item["value"] == target_value:
|
53
|
+
is_unit_exists = True
|
54
|
+
break
|
44
55
|
# Add Unit to Model State.
|
45
56
|
if not unit.is_delete:
|
46
57
|
if choices is not None:
|
47
|
-
|
58
|
+
if is_unit_exists:
|
59
|
+
main_lang = translations.DEFAULT_LOCALE
|
60
|
+
msg = (
|
61
|
+
"Error: It is impossible to add unit - "
|
62
|
+
+ f"Unit `{title[main_lang]}: {target_value}` is exists!"
|
63
|
+
)
|
64
|
+
raise PanicError(msg)
|
65
|
+
choices.append({"title": title, "value": target_value})
|
48
66
|
else:
|
49
|
-
choices = [{"title": title, "value":
|
50
|
-
model_state["data_dynamic_fields"][
|
67
|
+
choices = [{"title": title, "value": target_value}]
|
68
|
+
model_state["data_dynamic_fields"][unit_field] = choices
|
51
69
|
else:
|
52
70
|
# Delete Unit from Model State.
|
53
71
|
if choices is None:
|
54
|
-
msg =
|
55
|
-
"Error: It is not possible to delete Unit."
|
56
|
-
+ f"Title `{main_title}` not exists!"
|
57
|
-
)
|
72
|
+
msg = "Error: It is not possible to delete Unit - Units is not exists!"
|
58
73
|
raise PanicError(msg)
|
59
|
-
|
60
|
-
|
61
|
-
if main_title == item["title"][main_lang]:
|
62
|
-
is_key_exists = True
|
63
|
-
break
|
64
|
-
if not is_key_exists:
|
74
|
+
if not is_unit_exists:
|
75
|
+
main_lang = translations.DEFAULT_LOCALE
|
65
76
|
msg = (
|
66
77
|
"Error: It is not possible to delete Unit."
|
67
|
-
+ f"
|
78
|
+
+ f"Unit `{title[main_lang]}: {target_value}` is not exists!"
|
68
79
|
)
|
69
80
|
raise PanicError(msg)
|
70
|
-
choices = [item for item in choices if item["
|
71
|
-
model_state["data_dynamic_fields"][
|
81
|
+
choices = [item for item in choices if item["value"] != target_value]
|
82
|
+
model_state["data_dynamic_fields"][unit_field] = choices or None
|
72
83
|
# Update state of current Model in super collection.
|
73
84
|
await super_collection.replace_one(
|
74
85
|
filter={"collection_name": model_state["collection_name"]},
|
75
86
|
replacement=model_state,
|
76
87
|
)
|
77
88
|
# Update metadata of current Model.
|
78
|
-
cls.META["data_dynamic_fields"][
|
89
|
+
cls.META["data_dynamic_fields"][unit_field] = choices or None
|
79
90
|
# Update documents in the collection of the current Model.
|
80
91
|
if unit.is_delete:
|
81
|
-
unit_field: str = unit.field
|
82
|
-
unit_value: float | int | str | None = unit.value
|
83
92
|
collection: AsyncCollection = globals.MONGO_DATABASE[cls.META["collection_name"]]
|
84
93
|
async for mongo_doc in collection.find():
|
85
94
|
field_value = mongo_doc[unit_field]
|
86
95
|
if field_value is not None:
|
87
|
-
if isinstance(
|
96
|
+
if isinstance(field_value, list):
|
88
97
|
value_list = mongo_doc[unit_field]
|
89
|
-
value_list.remove(
|
98
|
+
value_list.remove(target_value)
|
90
99
|
mongo_doc[unit_field] = value_list or None
|
91
100
|
else:
|
92
101
|
mongo_doc[unit_field] = None
|
@@ -67,7 +67,7 @@ class ChoiceFloatDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: float | None = None
|
70
|
-
self.choices:
|
70
|
+
self.choices: list[tuple[float, str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -78,6 +78,6 @@ class ChoiceFloatDynField(Field, ChoiceGroup, JsonMixin):
|
|
78
78
|
choices = self.choices
|
79
79
|
if not bool(choices):
|
80
80
|
return False
|
81
|
-
if value not in choices
|
81
|
+
if value not in [item[0] for item in choices]: # type: ignore[union-attr]
|
82
82
|
return False
|
83
83
|
return True
|
@@ -27,7 +27,7 @@ class ChoiceFloatField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: float | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices:
|
30
|
+
choices: list[tuple[float | int | str, str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -52,8 +52,13 @@ class ChoiceFloatField(Field, ChoiceGroup, JsonMixin):
|
|
52
52
|
self.choices = choices
|
53
53
|
|
54
54
|
if globals.DEBUG:
|
55
|
-
if choices is not None
|
56
|
-
|
55
|
+
if choices is not None:
|
56
|
+
if not isinstance(choices, list):
|
57
|
+
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
58
|
+
if len(choices) == 0:
|
59
|
+
raise AssertionError(
|
60
|
+
"The `choices` parameter should not contain an empty list!"
|
61
|
+
)
|
57
62
|
if default is not None and not isinstance(default, float):
|
58
63
|
raise AssertionError("Parameter `default` - Not а `float` type!")
|
59
64
|
if default is not None and choices is not None and not self.has_value():
|
@@ -89,6 +94,6 @@ class ChoiceFloatField(Field, ChoiceGroup, JsonMixin):
|
|
89
94
|
choices = self.choices
|
90
95
|
if not bool(choices):
|
91
96
|
return False
|
92
|
-
if value not in choices
|
97
|
+
if value not in [item[0] for item in choices]: # type: ignore[union-attr]
|
93
98
|
return False
|
94
99
|
return True
|
@@ -67,7 +67,7 @@ class ChoiceFloatMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: list[float] | None = None
|
70
|
-
self.choices:
|
70
|
+
self.choices: list[tuple[float, str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -78,7 +78,7 @@ class ChoiceFloatMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
78
78
|
choices = self.choices
|
79
79
|
if len(value) == 0 or not bool(choices):
|
80
80
|
return False
|
81
|
-
value_list = choices
|
81
|
+
value_list = [item[0] for item in choices] # type: ignore[union-attr]
|
82
82
|
for item in value:
|
83
83
|
if item not in value_list:
|
84
84
|
return False
|
@@ -27,7 +27,7 @@ class ChoiceFloatMultField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: list[float] | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices:
|
30
|
+
choices: list[tuple[float | int | str, str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -54,8 +54,8 @@ class ChoiceFloatMultField(Field, ChoiceGroup, JsonMixin):
|
|
54
54
|
|
55
55
|
if globals.DEBUG:
|
56
56
|
if choices is not None:
|
57
|
-
if not isinstance(choices,
|
58
|
-
raise AssertionError("Parameter `choices` - Not а `
|
57
|
+
if not isinstance(choices, list):
|
58
|
+
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
59
59
|
if len(choices) == 0:
|
60
60
|
raise AssertionError(
|
61
61
|
"The `choices` parameter should not contain an empty list!"
|
@@ -100,7 +100,7 @@ class ChoiceFloatMultField(Field, ChoiceGroup, JsonMixin):
|
|
100
100
|
choices = self.choices
|
101
101
|
if len(value) == 0 or not bool(choices):
|
102
102
|
return False
|
103
|
-
value_list = choices
|
103
|
+
value_list = [item[0] for item in choices] # type: ignore[union-attr]
|
104
104
|
for item in value:
|
105
105
|
if item not in value_list:
|
106
106
|
return False
|
@@ -67,7 +67,7 @@ class ChoiceIntDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: int | None = None
|
70
|
-
self.choices:
|
70
|
+
self.choices: list[tuple[int, str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -78,6 +78,6 @@ class ChoiceIntDynField(Field, ChoiceGroup, JsonMixin):
|
|
78
78
|
choices = self.choices
|
79
79
|
if not bool(choices):
|
80
80
|
return False
|
81
|
-
if value not in choices
|
81
|
+
if value not in [item[0] for item in choices]: # type: ignore[union-attr]
|
82
82
|
return False
|
83
83
|
return True
|
@@ -27,7 +27,7 @@ class ChoiceIntField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: int | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices:
|
30
|
+
choices: list[tuple[int, str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -52,8 +52,13 @@ class ChoiceIntField(Field, ChoiceGroup, JsonMixin):
|
|
52
52
|
self.choices = choices
|
53
53
|
|
54
54
|
if globals.DEBUG:
|
55
|
-
if choices is not None
|
56
|
-
|
55
|
+
if choices is not None:
|
56
|
+
if not isinstance(choices, list):
|
57
|
+
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
58
|
+
if len(choices) == 0:
|
59
|
+
raise AssertionError(
|
60
|
+
"The `choices` parameter should not contain an empty list!"
|
61
|
+
)
|
57
62
|
if default is not None and not isinstance(default, int):
|
58
63
|
raise AssertionError("Parameter `default` - Not а `str` type!")
|
59
64
|
if default is not None and choices is not None and not self.has_value():
|
@@ -89,6 +94,6 @@ class ChoiceIntField(Field, ChoiceGroup, JsonMixin):
|
|
89
94
|
choices = self.choices
|
90
95
|
if not bool(choices):
|
91
96
|
return False
|
92
|
-
if value not in choices
|
97
|
+
if value not in [item[0] for item in choices]: # type: ignore[union-attr]
|
93
98
|
return False
|
94
99
|
return True
|
@@ -67,7 +67,7 @@ class ChoiceIntMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: list[int] | None = None
|
70
|
-
self.choices:
|
70
|
+
self.choices: list[tuple[int, str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -78,7 +78,7 @@ class ChoiceIntMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
78
78
|
choices = self.choices
|
79
79
|
if len(value) == 0 or not bool(choices):
|
80
80
|
return False
|
81
|
-
value_list = choices
|
81
|
+
value_list = [item[0] for item in choices] # type: ignore[union-attr]
|
82
82
|
for item in value:
|
83
83
|
if item not in value_list:
|
84
84
|
return False
|
@@ -27,7 +27,7 @@ class ChoiceIntMultField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: list[int] | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices:
|
30
|
+
choices: list[tuple[int, str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -54,8 +54,8 @@ class ChoiceIntMultField(Field, ChoiceGroup, JsonMixin):
|
|
54
54
|
|
55
55
|
if globals.DEBUG:
|
56
56
|
if choices is not None:
|
57
|
-
if not isinstance(choices,
|
58
|
-
raise AssertionError("Parameter `choices` - Not а `
|
57
|
+
if not isinstance(choices, list):
|
58
|
+
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
59
59
|
if len(choices) == 0:
|
60
60
|
raise AssertionError(
|
61
61
|
"The `choices` parameter should not contain an empty list!"
|
@@ -100,7 +100,7 @@ class ChoiceIntMultField(Field, ChoiceGroup, JsonMixin):
|
|
100
100
|
choices = self.choices
|
101
101
|
if len(value) == 0 or not bool(choices):
|
102
102
|
return False
|
103
|
-
value_list = choices
|
103
|
+
value_list = [item[0] for item in choices] # type: ignore[union-attr]
|
104
104
|
for item in value:
|
105
105
|
if item not in value_list:
|
106
106
|
return False
|
@@ -67,7 +67,7 @@ class ChoiceTextDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: str | None = None
|
70
|
-
self.choices:
|
70
|
+
self.choices: list[tuple[str, str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -78,6 +78,6 @@ class ChoiceTextDynField(Field, ChoiceGroup, JsonMixin):
|
|
78
78
|
choices = self.choices
|
79
79
|
if not bool(choices):
|
80
80
|
return False
|
81
|
-
if value not in choices
|
81
|
+
if value not in [item[0] for item in choices]: # type: ignore[union-attr]
|
82
82
|
return False
|
83
83
|
return True
|
@@ -27,7 +27,7 @@ class ChoiceTextField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: str | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices:
|
30
|
+
choices: list[tuple[str, str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -52,8 +52,13 @@ class ChoiceTextField(Field, ChoiceGroup, JsonMixin):
|
|
52
52
|
self.choices = choices
|
53
53
|
|
54
54
|
if globals.DEBUG:
|
55
|
-
if choices is not None
|
56
|
-
|
55
|
+
if choices is not None:
|
56
|
+
if not isinstance(choices, list):
|
57
|
+
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
58
|
+
if len(choices) == 0:
|
59
|
+
raise AssertionError(
|
60
|
+
"The `choices` parameter should not contain an empty list!"
|
61
|
+
)
|
57
62
|
if default is not None:
|
58
63
|
if not isinstance(default, str):
|
59
64
|
raise AssertionError("Parameter `default` - Not а `str` type!")
|
@@ -94,6 +99,6 @@ class ChoiceTextField(Field, ChoiceGroup, JsonMixin):
|
|
94
99
|
choices = self.choices
|
95
100
|
if not bool(choices):
|
96
101
|
return False
|
97
|
-
if value not in choices
|
102
|
+
if value not in [item[0] for item in choices]: # type: ignore[union-attr]
|
98
103
|
return False
|
99
104
|
return True
|
@@ -67,7 +67,7 @@ class ChoiceTextMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: list[str] | None = None
|
70
|
-
self.choices:
|
70
|
+
self.choices: list[tuple[str, str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -78,7 +78,7 @@ class ChoiceTextMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
78
78
|
choices = self.choices
|
79
79
|
if len(value) == 0 or not bool(choices):
|
80
80
|
return False
|
81
|
-
value_list = choices
|
81
|
+
value_list = [item[0] for item in choices] # type: ignore[union-attr]
|
82
82
|
for item in value:
|
83
83
|
if item not in value_list:
|
84
84
|
return False
|
@@ -27,7 +27,7 @@ class ChoiceTextMultField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: list[str] | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices:
|
30
|
+
choices: list[tuple[str, str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -54,8 +54,8 @@ class ChoiceTextMultField(Field, ChoiceGroup, JsonMixin):
|
|
54
54
|
|
55
55
|
if globals.DEBUG:
|
56
56
|
if choices is not None:
|
57
|
-
if not isinstance(choices,
|
58
|
-
raise AssertionError("Parameter `choices` - Not а `
|
57
|
+
if not isinstance(choices, list):
|
58
|
+
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
59
59
|
if len(choices) == 0:
|
60
60
|
raise AssertionError(
|
61
61
|
"The `choices` parameter should not contain an empty list!"
|
@@ -100,7 +100,7 @@ class ChoiceTextMultField(Field, ChoiceGroup, JsonMixin):
|
|
100
100
|
choices = self.choices
|
101
101
|
if len(value) == 0 or not bool(choices):
|
102
102
|
return False
|
103
|
-
value_list = choices
|
103
|
+
value_list = [item[0] for item in choices] # type: ignore[union-attr]
|
104
104
|
for item in value:
|
105
105
|
if item not in value_list:
|
106
106
|
return False
|
ramifice/models/model.py
CHANGED
@@ -78,9 +78,9 @@ class Model(metaclass=ABCMeta):
|
|
78
78
|
if "Dyn" in f_type.field_type:
|
79
79
|
dyn_data = data_dynamic_fields[f_name]
|
80
80
|
if dyn_data is not None:
|
81
|
-
f_type.choices =
|
82
|
-
item["
|
83
|
-
|
81
|
+
f_type.choices = [
|
82
|
+
(item["value"], item["title"][lang]) for item in dyn_data
|
83
|
+
]
|
84
84
|
else:
|
85
85
|
# This is necessary for
|
86
86
|
# `paladins > refrash > RefrashMixin > refrash_from_db`.
|
ramifice/utils/migration.py
CHANGED
@@ -189,7 +189,7 @@ class Monitor:
|
|
189
189
|
"data_dynamic_fields"
|
190
190
|
][field_name]
|
191
191
|
# Refresh state of current Model.
|
192
|
-
model_state["
|
192
|
+
model_state["data_dynamic_fields"] = metadata["data_dynamic_fields"]
|
193
193
|
model_state["field_name_and_type"] = metadata["field_name_and_type"]
|
194
194
|
await super_collection.replace_one(
|
195
195
|
filter={"collection_name": model_state["collection_name"]},
|
ramifice/utils/unit.py
CHANGED
@@ -20,7 +20,7 @@ class Unit(JsonMixin):
|
|
20
20
|
self,
|
21
21
|
field: str,
|
22
22
|
title: dict[str, str], # Example: {"en": "Title", "ru": "Заголовок"}
|
23
|
-
value: float | int | str
|
23
|
+
value: float | int | str,
|
24
24
|
is_delete: bool = False,
|
25
25
|
):
|
26
26
|
# Check the match of types.
|
@@ -33,8 +33,8 @@ class Unit(JsonMixin):
|
|
33
33
|
+ 'Example: {"en": "Title", "ru": "Заголовок"}'
|
34
34
|
)
|
35
35
|
raise PanicError(msg)
|
36
|
-
if not isinstance(value, (float, int, str
|
37
|
-
msg = "Class: `Unit` > Field: `value` => Not а `float | int | str
|
36
|
+
if not isinstance(value, (float, int, str)):
|
37
|
+
msg = "Class: `Unit` > Field: `value` => Not а `float | int | str` type!"
|
38
38
|
raise PanicError(msg)
|
39
39
|
if not isinstance(is_delete, bool):
|
40
40
|
msg = "Class: `Unit` > Field: `is_delete` => Not а `bool` type!"
|
@@ -47,10 +47,10 @@ class Unit(JsonMixin):
|
|
47
47
|
self.value = value
|
48
48
|
self.is_delete = is_delete
|
49
49
|
|
50
|
-
self.
|
50
|
+
self.check_empty_arguments()
|
51
51
|
|
52
|
-
def
|
53
|
-
"""Check
|
52
|
+
def check_empty_arguments(self) -> None:
|
53
|
+
"""Check the arguments for empty values.
|
54
54
|
|
55
55
|
Returns:
|
56
56
|
`None` or raised exception `PanicError`.
|
@@ -61,14 +61,6 @@ class Unit(JsonMixin):
|
|
61
61
|
field_name = "field"
|
62
62
|
elif len(self.title) == 0:
|
63
63
|
field_name = "title"
|
64
|
-
elif self.value is None and self.is_delete == False:
|
65
|
-
msg = (
|
66
|
-
"Method: `unit_manager` > "
|
67
|
-
+ "Argument: `unit` > "
|
68
|
-
+ f"Field: `{field_name}` => "
|
69
|
-
+ "For `value` = None, `is_delete` should be True!"
|
70
|
-
)
|
71
|
-
raise PanicError(msg)
|
72
64
|
elif isinstance(self.value, str) and len(self.value) == 0:
|
73
65
|
field_name = "value"
|
74
66
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ramifice
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.5
|
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/
|
@@ -542,7 +542,7 @@ async for index in await User.list_indexes():
|
|
542
542
|
from ramifice import Unit
|
543
543
|
unit = Unit(
|
544
544
|
field="field_name", # The name of the dynamic field.
|
545
|
-
title="Title", # The name of the choice item.
|
545
|
+
title={"en": "Title", "ru": "Заголовок"}, # The name of the choice item.
|
546
546
|
value="Some text ...", # The value of the choice item.
|
547
547
|
# Hint: float | int | str
|
548
548
|
is_delete=False, # True - if you need to remove the item of choice.
|
@@ -6,21 +6,21 @@ ramifice/commons/indexes.py,sha256=hAcWKZ9MMgLbRtoQ6Af0b8r-PY0dbEYmMBl8z_d1DRo,3
|
|
6
6
|
ramifice/commons/many.py,sha256=jkah1kO1CXWPB0xW0dbMelCFBSirRYkX9a333EcPE_M,9202
|
7
7
|
ramifice/commons/one.py,sha256=uZsgwg_GgA1VMZDPqhRFMmCdtvcv6xsL4DWbCOwGV3w,6730
|
8
8
|
ramifice/commons/tools.py,sha256=ectaILVYCSwNbB0VAys6nIhdsJbwuxAupNvcQfweC88,2366
|
9
|
-
ramifice/commons/unit_manager.py,sha256=
|
9
|
+
ramifice/commons/unit_manager.py,sha256=4spjvTv29AYSWaIP2A4k9E1vawPmwFau9GFK_yaveb8,4488
|
10
10
|
ramifice/fields/__init__.py,sha256=yRfX7Tvpuh27Ggcx5u9e1RRYK7Wu59EVJYxxetmuP1w,1290
|
11
11
|
ramifice/fields/bool_field.py,sha256=WWubSwsFJZu8b3MviDd2zXnNYOQaYw8toklFNSTVFLA,2072
|
12
|
-
ramifice/fields/choice_float_dyn_field.py,sha256=
|
13
|
-
ramifice/fields/choice_float_field.py,sha256=
|
14
|
-
ramifice/fields/choice_float_mult_dyn_field.py,sha256=
|
15
|
-
ramifice/fields/choice_float_mult_field.py,sha256=
|
16
|
-
ramifice/fields/choice_int_dyn_field.py,sha256=
|
17
|
-
ramifice/fields/choice_int_field.py,sha256=
|
18
|
-
ramifice/fields/choice_int_mult_dyn_field.py,sha256=
|
19
|
-
ramifice/fields/choice_int_mult_field.py,sha256=
|
20
|
-
ramifice/fields/choice_text_dyn_field.py,sha256=
|
21
|
-
ramifice/fields/choice_text_field.py,sha256=
|
22
|
-
ramifice/fields/choice_text_mult_dyn_field.py,sha256=
|
23
|
-
ramifice/fields/choice_text_mult_field.py,sha256=
|
12
|
+
ramifice/fields/choice_float_dyn_field.py,sha256=GMyKWLjNCP7TeQl1rnM3S7GBPd0N0so_CCCYcuGQLZM,3113
|
13
|
+
ramifice/fields/choice_float_field.py,sha256=gXs6-QqFcG37aeHt_6QsgQOJyYa9Q5N95p7g9oEOP9E,3918
|
14
|
+
ramifice/fields/choice_float_mult_dyn_field.py,sha256=Uq8eyjiOVVL_K__-C5UJCsUcgXdFYMluZBSJatGz528,3176
|
15
|
+
ramifice/fields/choice_float_mult_field.py,sha256=1RO4cri-LzZgqZrSK8InF5zKfOMzlbj79Kue1_EPj8M,4264
|
16
|
+
ramifice/fields/choice_int_dyn_field.py,sha256=O4cTaFIZdxZgb3AZmDIHrYwavBaG-pf-s3fF8fSeu2I,3107
|
17
|
+
ramifice/fields/choice_int_field.py,sha256=VJi_9Ilp9Vei4qDqii4OSV_xzpZJHmxeYb5Lfxkvf6Y,3894
|
18
|
+
ramifice/fields/choice_int_mult_dyn_field.py,sha256=G4iLbgipjNIuwQjh0mXo04npp7wpDnvVOlb3LmJKUEg,3172
|
19
|
+
ramifice/fields/choice_int_mult_field.py,sha256=J-oRNoPoF-cgAbHlxtVTU7E-OeLf-Z-E2gL2036qhRc,4246
|
20
|
+
ramifice/fields/choice_text_dyn_field.py,sha256=xFAOzdTKzrJg73-7CvNjovj-Dnj0ONmZi-sUz2vvcEI,3103
|
21
|
+
ramifice/fields/choice_text_field.py,sha256=L1j36BX6pKtS661ZSYtrD9tuAjxD2puRGOvrdEBqcS8,4099
|
22
|
+
ramifice/fields/choice_text_mult_dyn_field.py,sha256=HtDd7X70VlIJ2SdCTVr_8dZvw_oPw79QC0YjGaOZQlA,3168
|
23
|
+
ramifice/fields/choice_text_mult_field.py,sha256=UGKbAJQaX1pq0KFJnvgEYYKlrr_eGsaFY2eOA-43NRw,4242
|
24
24
|
ramifice/fields/color_field.py,sha256=NdYey3Og8hh7oK7yDljrG6K8frgqj4C2OTXFnJVAYFQ,3526
|
25
25
|
ramifice/fields/date_field.py,sha256=w875p6JwssKhEZJLBHmC8sE5wArn161rlQi0Zt-qEZo,5214
|
26
26
|
ramifice/fields/date_time_field.py,sha256=OGi-ED-Gm_AWGzczHA1qch59IuWy3KkVIJHQl3OlatU,5249
|
@@ -45,7 +45,7 @@ ramifice/fields/general/number_group.py,sha256=AqlCY-t6JHZ2QVBe7mk5nPt6z8M4VJ_RA
|
|
45
45
|
ramifice/fields/general/text_group.py,sha256=6GD2Fe6Toz6zZjAAlcy5rPVCAGh6Yn1ltdIrFg9RF18,1057
|
46
46
|
ramifice/models/__init__.py,sha256=h_QQ5rSJNZ-7kmx7wIFd8E8RmUS94b_x4jdwMbq8zm4,15
|
47
47
|
ramifice/models/decorator.py,sha256=U1ukWWq2voEwvKonQAzihqGYVsoyPrOQ2jDXJZ-UcMc,7251
|
48
|
-
ramifice/models/model.py,sha256=
|
48
|
+
ramifice/models/model.py,sha256=Ydz4kpYiEjjhxkiwhJmSIZM--lKe0QE38yL6wh2eITM,7104
|
49
49
|
ramifice/models/pseudo.py,sha256=0PBLHUmoT5eXzIaZtTQ20IaNUPRAuRGGfRWbUypPtfc,6765
|
50
50
|
ramifice/paladins/__init__.py,sha256=PIP3AXI2KBRXNcLJUF0d7ygJ7VLOAxlhb4HRKQ9MGYY,516
|
51
51
|
ramifice/paladins/check.py,sha256=ennDiVAoCZIS3aKBK0eA-Vt8VJQnbIv90be5IFYraFg,7026
|
@@ -70,16 +70,16 @@ ramifice/utils/__init__.py,sha256=xixHoOX4ja5jIUZemem1qn4k4aonv3G3Q76azQK_pkU,43
|
|
70
70
|
ramifice/utils/errors.py,sha256=iuhq7fzpUmsOyeXeg2fJjta8yAuqlXLKsZVMpfUhtHE,1901
|
71
71
|
ramifice/utils/fixtures.py,sha256=qsv9cg06lc82XaRlhI1j5vftmOQTTwOcDXCg_lnpK04,3159
|
72
72
|
ramifice/utils/globals.py,sha256=uR20um3Qg_1SG1t7WyWbpq8kQD-9Mslyr_c1yh5Hw9w,1751
|
73
|
-
ramifice/utils/migration.py,sha256=
|
73
|
+
ramifice/utils/migration.py,sha256=kx1JX0xSgebtNtoTm_161_MqBw5kpsqCfIsc8wXYc34,11060
|
74
74
|
ramifice/utils/tools.py,sha256=sOKzwnvf6vdTNf9r6PKAdw6aB4undat2Z8tzS3M1GnQ,2733
|
75
75
|
ramifice/utils/translations.py,sha256=GNGE0ULAA0aOY5pTxUd3MQW-nVaKvp6BeXWEcsR0s0o,4048
|
76
|
-
ramifice/utils/unit.py,sha256=
|
76
|
+
ramifice/utils/unit.py,sha256=R34gxriT67vI6PmjMIRftNsSP036jwbnsYjxt1Wma48,2454
|
77
77
|
ramifice/utils/mixins/__init__.py,sha256=-UxYokZSlEaqoIs0aPVGtzK2CgN88mTzyhryHEtt0Yo,181
|
78
78
|
ramifice/utils/mixins/add_valid.py,sha256=TLOObedzXNA9eCylfAVbVCqIKE5sV-P5AdIN7avj-GA,407
|
79
79
|
ramifice/utils/mixins/hooks.py,sha256=33jvJRhfnJeL2Hd_YFXk3M_7wjqHaByU2wRjKyboL6s,914
|
80
80
|
ramifice/utils/mixins/indexing.py,sha256=Z0427HoaVRyNmSNN8Fx0mSICgAKV-gDdu3iR5qYUEbs,329
|
81
81
|
ramifice/utils/mixins/json_converter.py,sha256=WhigXyDAV-FfILaZuwvRFRIk0D90Rv3dG5t-mv5fVyc,1107
|
82
|
-
ramifice-0.5.
|
83
|
-
ramifice-0.5.
|
84
|
-
ramifice-0.5.
|
85
|
-
ramifice-0.5.
|
82
|
+
ramifice-0.5.5.dist-info/METADATA,sha256=6W2LY7y6TfZ0IuzAo23fTINKZgqSz_YA_UwgdmtmDyw,22536
|
83
|
+
ramifice-0.5.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
84
|
+
ramifice-0.5.5.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
|
85
|
+
ramifice-0.5.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|