ramifice 0.4.9__py3-none-any.whl → 0.4.11__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.
@@ -69,8 +69,10 @@ class ChoiceFloatDynField(Field, ChoiceGroup, JsonMixin):
69
69
  self.value: float | None = None
70
70
  self.choices: dict[str, float] | None = None
71
71
 
72
- def has_value(self) -> bool:
72
+ def has_value(self, is_migrate: bool = False) -> bool:
73
73
  """Does the field value match the possible options in choices."""
74
+ if is_migrate:
75
+ return True
74
76
  value = self.value
75
77
  if value is not None:
76
78
  choices = self.choices
@@ -80,7 +80,7 @@ class ChoiceFloatField(Field, ChoiceGroup, JsonMixin):
80
80
  if not isinstance(readonly, bool):
81
81
  raise AssertionError("Parameter `readonly` - Not а `bool` type!")
82
82
 
83
- def has_value(self) -> bool:
83
+ def has_value(self, is_migrate: bool = False) -> bool:
84
84
  """Does the field value match the possible options in choices."""
85
85
  value = self.value
86
86
  if value is None:
@@ -69,8 +69,10 @@ class ChoiceFloatMultDynField(Field, ChoiceGroup, JsonMixin):
69
69
  self.value: list[float] | None = None
70
70
  self.choices: dict[str, float] | None = None
71
71
 
72
- def has_value(self) -> bool:
72
+ def has_value(self, is_migrate: bool = False) -> bool:
73
73
  """Does the field value match the possible options in choices."""
74
+ if is_migrate:
75
+ return True
74
76
  value = self.value
75
77
  if value is not None:
76
78
  choices = self.choices
@@ -91,7 +91,7 @@ class ChoiceFloatMultField(Field, ChoiceGroup, JsonMixin):
91
91
  if not isinstance(readonly, bool):
92
92
  raise AssertionError("Parameter `readonly` - Not а `bool` type!")
93
93
 
94
- def has_value(self) -> bool:
94
+ def has_value(self, is_migrate: bool = False) -> bool:
95
95
  """Does the field value match the possible options in choices."""
96
96
  value = self.value
97
97
  if value is None:
@@ -69,8 +69,10 @@ class ChoiceIntDynField(Field, ChoiceGroup, JsonMixin):
69
69
  self.value: int | None = None
70
70
  self.choices: dict[str, int] | None = None
71
71
 
72
- def has_value(self) -> bool:
72
+ def has_value(self, is_migrate: bool = False) -> bool:
73
73
  """Does the field value match the possible options in choices."""
74
+ if is_migrate:
75
+ return True
74
76
  value = self.value
75
77
  if value is not None:
76
78
  choices = self.choices
@@ -80,7 +80,7 @@ class ChoiceIntField(Field, ChoiceGroup, JsonMixin):
80
80
  if not isinstance(readonly, bool):
81
81
  raise AssertionError("Parameter `readonly` - Not а `bool` type!")
82
82
 
83
- def has_value(self) -> bool:
83
+ def has_value(self, is_migrate: bool = False) -> bool:
84
84
  """Does the field value match the possible options in choices."""
85
85
  value = self.value
86
86
  if value is None:
@@ -69,8 +69,10 @@ class ChoiceIntMultDynField(Field, ChoiceGroup, JsonMixin):
69
69
  self.value: list[int] | None = None
70
70
  self.choices: dict[str, int] | None = None
71
71
 
72
- def has_value(self) -> bool:
72
+ def has_value(self, is_migrate: bool = False) -> bool:
73
73
  """Does the field value match the possible options in choices."""
74
+ if is_migrate:
75
+ return True
74
76
  value = self.value
75
77
  if value is not None:
76
78
  choices = self.choices
@@ -91,7 +91,7 @@ class ChoiceIntMultField(Field, ChoiceGroup, JsonMixin):
91
91
  if not isinstance(readonly, bool):
92
92
  raise AssertionError("Parameter `readonly` - Not а `bool` type!")
93
93
 
94
- def has_value(self) -> bool:
94
+ def has_value(self, is_migrate: bool = False) -> bool:
95
95
  """Does the field value match the possible options in choices."""
96
96
  value = self.value
97
97
  if value is None:
@@ -69,8 +69,10 @@ class ChoiceTextDynField(Field, ChoiceGroup, JsonMixin):
69
69
  self.value: str | None = None
70
70
  self.choices: dict[str, str] | None = None
71
71
 
72
- def has_value(self) -> bool:
72
+ def has_value(self, is_migrate: bool = False) -> bool:
73
73
  """Does the field value match the possible options in choices."""
74
+ if is_migrate:
75
+ return True
74
76
  value = self.value
75
77
  if value is not None:
76
78
  choices = self.choices
@@ -85,7 +85,7 @@ class ChoiceTextField(Field, ChoiceGroup, JsonMixin):
85
85
  if not isinstance(readonly, bool):
86
86
  raise AssertionError("Parameter `readonly` - Not а `bool` type!")
87
87
 
88
- def has_value(self) -> bool:
88
+ def has_value(self, is_migrate: bool = False) -> bool:
89
89
  """Does the field value match the possible options in choices."""
90
90
  value = self.value
91
91
  if value is None:
@@ -69,8 +69,10 @@ class ChoiceTextMultDynField(Field, ChoiceGroup, JsonMixin):
69
69
  self.value: list[str] | None = None
70
70
  self.choices: dict[str, str] | None = None
71
71
 
72
- def has_value(self) -> bool:
72
+ def has_value(self, is_migrate: bool = False) -> bool:
73
73
  """Does the field value match the possible options in choices."""
74
+ if is_migrate:
75
+ return True
74
76
  value = self.value
75
77
  if value is not None:
76
78
  choices = self.choices
@@ -91,7 +91,7 @@ class ChoiceTextMultField(Field, ChoiceGroup, JsonMixin):
91
91
  if not isinstance(readonly, bool):
92
92
  raise AssertionError("Parameter `readonly` - Not а `bool` type!")
93
93
 
94
- def has_value(self) -> bool:
94
+ def has_value(self, is_migrate: bool = False) -> bool:
95
95
  """Does the field value match the possible options in choices."""
96
96
  value = self.value
97
97
  if value is None:
@@ -38,7 +38,10 @@ class CheckMixin(
38
38
  """Validation of Model data before saving to the database."""
39
39
 
40
40
  async def check(
41
- self, is_save: bool = False, collection: AsyncCollection | None = None
41
+ self,
42
+ is_save: bool = False,
43
+ collection: AsyncCollection | None = None,
44
+ is_migration_process: bool = False,
42
45
  ) -> dict[str, Any]:
43
46
  """Validation of Model data before saving to the database.
44
47
 
@@ -84,6 +87,7 @@ class CheckMixin(
84
87
  "field_data": None,
85
88
  "full_model_name": cls_model.META["full_model_name"],
86
89
  "is_migrate_model": is_migrate_model,
90
+ "is_migration_process": is_migration_process,
87
91
  "curr_doc": (
88
92
  await collection.find_one({"_id": doc_id}) if is_save and is_update else None
89
93
  ),
@@ -26,6 +26,7 @@ class ChoiceGroupMixin:
26
26
  def choice_group(self, params: dict[str, Any]) -> None:
27
27
  """Checking choice fields."""
28
28
  field = params["field_data"]
29
+ is_migrate = params["is_migration_process"]
29
30
  # Get current value.
30
31
  value = field.value or field.__dict__.get("default") or None
31
32
 
@@ -37,7 +38,7 @@ class ChoiceGroupMixin:
37
38
  params["result_map"][field.name] = None
38
39
  return
39
40
  # Does the field value match the possible options in choices.
40
- if not field.has_value():
41
+ if not field.has_value(is_migrate):
41
42
  err_msg = translations._("Your choice does not match the options offered !")
42
43
  accumulate_error(err_msg, params)
43
44
  # Insert result.
@@ -102,7 +102,7 @@ class Monitor:
102
102
  # Delete collection associated with non-existent Model.
103
103
  await database.drop_collection(collection_name) # type: ignore[union-attr]
104
104
 
105
- async def migrat(self) -> None:
105
+ async def migrate(self) -> None:
106
106
  """Run migration process.
107
107
 
108
108
  1) Update the state of Models in the super collection.
@@ -154,7 +154,9 @@ class Monitor:
154
154
  #
155
155
  inst_model = cls_model.from_mongo_doc(mongo_doc)
156
156
  result_check: dict[str, Any] = await inst_model.check(
157
- is_save=True, collection=model_collection
157
+ is_save=True,
158
+ collection=model_collection,
159
+ is_migration_process=True,
158
160
  )
159
161
  if not result_check["is_valid"]:
160
162
  print(colored("\n!!!>>MIGRATION<<!!!", "red", attrs=["bold"]))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ramifice
3
- Version: 0.4.9
3
+ Version: 0.4.11
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/
@@ -12,7 +12,7 @@ Author-email: Gennady Kostyunin <kebasyaty@gmail.com>
12
12
  License-Expression: MIT
13
13
  License-File: LICENSE
14
14
  Keywords: mongo,mongodb,orm,pymongo,ramifice
15
- Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Development Status :: 4 - Beta
16
16
  Classifier: Intended Audience :: Developers
17
17
  Classifier: License :: OSI Approved :: MIT License
18
18
  Classifier: Programming Language :: Python :: 3
@@ -82,7 +82,7 @@ _For more information see [PyMongo](https://pypi.org/project/pymongo/ "PyMongo")
82
82
 
83
83
  <p>
84
84
  <a href="https://github.com/kebasyaty/ramifice" alt="Project Status">
85
- <img src="https://raw.githubusercontent.com/kebasyaty/ramifice/v0/assets/project_status/project-status-alpha.svg"
85
+ <img src="https://raw.githubusercontent.com/kebasyaty/ramifice/v0/assets/project_status/project-status-beta.svg"
86
86
  alt="Project Status">
87
87
  </a>
88
88
  </p>
@@ -220,7 +220,7 @@ async def main():
220
220
  await migration.Monitor(
221
221
  database_name="test_db",
222
222
  mongo_client=client,
223
- ).migrat()
223
+ ).migrate()
224
224
 
225
225
  # If you need to change the language of translation.
226
226
  # Hint: For Ramifice by default = "en"
@@ -9,18 +9,18 @@ ramifice/commons/tools.py,sha256=s4CdHb9h8aqR371py0KVsBnNBJSW8-7AVjbTmuFAeeg,179
9
9
  ramifice/commons/unit_manager.py,sha256=IkWqXu1PHHal0aGfx6zme81iXPeygxPqEWO-u_8RXoI,4356
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=_QqZHJ9UDaKPWUlvzwAmf0BepKaA3AOhJWVsmajcqbM,3018
13
- ramifice/fields/choice_float_field.py,sha256=xoeKVFyAB9Ns64DAEiRjXWBuY7tEECSr6sKApz1NOz4,3649
14
- ramifice/fields/choice_float_mult_dyn_field.py,sha256=ERjg-eyZObT-ifMBdk78Ez04YlRz7kY_jhcS5QpEp0s,3081
15
- ramifice/fields/choice_float_mult_field.py,sha256=5pUWsZ8Z7OBo85OlZxlyPGNfwjOAfbNpbjgjgodpXZ0,4206
16
- ramifice/fields/choice_int_dyn_field.py,sha256=3Wu1alewYrQRPIbnXRrjsAp2E50xGK466x6YQbVQG7I,3012
17
- ramifice/fields/choice_int_field.py,sha256=emmmygqEXwwHMc49cV8a4y8iX-jHbwxLxRGjg2e0hig,3637
18
- ramifice/fields/choice_int_mult_dyn_field.py,sha256=olcebbGXz8ru8xZ1I1RwLdzIzYMUYBEInOerG_ci2k8,3077
19
- ramifice/fields/choice_int_mult_field.py,sha256=r4KN12VD8XtftboCiYfN2M9bg3RmZe8mHj2_6agEo1g,4200
20
- ramifice/fields/choice_text_dyn_field.py,sha256=M-Rkb4YyLjSmOBT8WE-fiNapQgk4uZnQMktVW6fMix4,3008
21
- ramifice/fields/choice_text_field.py,sha256=jzWNow_nPPzLLdFYyhrMvNALp0fqWbccyB3pUwhrH7k,3842
22
- ramifice/fields/choice_text_mult_dyn_field.py,sha256=5jch2i8fLn9Unkanm-zNA_0yegtTVsjcuJDg2TpzLRA,3073
23
- ramifice/fields/choice_text_mult_field.py,sha256=wzYQlWQmwYtg4LhK8n-ycX3ijac5Q6vwRHqRgG7WQNs,4196
12
+ ramifice/fields/choice_float_dyn_field.py,sha256=Yrd9cNKLm0mhU-P3IojwFRLSbuxdp7f2NMGJhrRWsf8,3093
13
+ ramifice/fields/choice_float_field.py,sha256=GX7ygsflgXFwwU5Gacq8EsXTdzdgNxWfT5ys8z4s2K8,3675
14
+ ramifice/fields/choice_float_mult_dyn_field.py,sha256=zDaJ_-qSytIXfY4EH43QwPB0dtkQfHPCGSZI7VMDnoo,3156
15
+ ramifice/fields/choice_float_mult_field.py,sha256=TArh0D13F9JuJjFn7WDrBzAqDCL03T35z1nZB4T55Rw,4232
16
+ ramifice/fields/choice_int_dyn_field.py,sha256=pryP7KDvRexKBo9mQTwN61Rnyuhiiv_ZHw56wWFe_bs,3087
17
+ ramifice/fields/choice_int_field.py,sha256=OyuADapAIwlutYvAtu-g7hwmq251e9cHMqKP4dm9Du8,3663
18
+ ramifice/fields/choice_int_mult_dyn_field.py,sha256=BZbH0SUcJji6daazj3ovBYCaY1o00rMBbEFzCzDu7b4,3152
19
+ ramifice/fields/choice_int_mult_field.py,sha256=4PZx0Wv1R2Wq5JZWQNqqYi_4OX13KNwdxlwlyKqndZM,4226
20
+ ramifice/fields/choice_text_dyn_field.py,sha256=HcJXq9HHgglz_BTOpGfvXmxH2BGhXze_-QAampmTGnI,3083
21
+ ramifice/fields/choice_text_field.py,sha256=JHauvxmYIbxUMjCgOHI0IcBNT2zv2gPH0njp6qXlKr4,3868
22
+ ramifice/fields/choice_text_mult_dyn_field.py,sha256=GmoRveIQjidAV-NOmfEO2irlG6agRHpMKNUFVzKSGiM,3148
23
+ ramifice/fields/choice_text_mult_field.py,sha256=RHB38fNL4ppasE-x2jJE73s221sDZ-YX3-WgpYsI_kA,4222
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
@@ -48,7 +48,7 @@ ramifice/models/decorator.py,sha256=jOEn-0v0m_tM7mow45-tM-8LADUmwlG2DWZsEuC9S_w,
48
48
  ramifice/models/model.py,sha256=ZvgIbcuSXuAkBl_FofOZXGwWMwlqKB-PwTMyXiqK-Fo,6610
49
49
  ramifice/models/pseudo.py,sha256=PhLQM4zXdaOtTSmNFzwN4twlUmdvA1D_-YOMJtaOIwM,6754
50
50
  ramifice/paladins/__init__.py,sha256=PIP3AXI2KBRXNcLJUF0d7ygJ7VLOAxlhb4HRKQ9MGYY,516
51
- ramifice/paladins/check.py,sha256=9VQmr3GXaGitMQl-3KOZP-2_xYC7JG_jDLM62iKx1b4,6903
51
+ ramifice/paladins/check.py,sha256=ennDiVAoCZIS3aKBK0eA-Vt8VJQnbIv90be5IFYraFg,7026
52
52
  ramifice/paladins/delete.py,sha256=tw50E98D5eFZ7gHGnh_8ztUB1LeTeWWKZvIcQqlgbF8,3352
53
53
  ramifice/paladins/password.py,sha256=w1XWh3bsncH1VTVjCLxyKI2waxMvltwcsPWW3V9Ib84,3027
54
54
  ramifice/paladins/refrash.py,sha256=fw-9x_NKGzreipBt_F9KF6FTsYm9hSzfq4ubi1FHYrQ,1065
@@ -57,7 +57,7 @@ ramifice/paladins/tools.py,sha256=QxxwZILyBLcAiDUN48KE99c_cHVjG-VYilEsIinRhEU,26
57
57
  ramifice/paladins/validation.py,sha256=gcEJXIEPu1g7Z54vl14YTs5rCmxOEYsgQH1usFfyy7k,1730
58
58
  ramifice/paladins/groups/__init__.py,sha256=hpqmWLsYAMvZHAbmMXluQSqLhkHOSTUAgLHyTM1LTYI,472
59
59
  ramifice/paladins/groups/bool_group.py,sha256=oJc9mw9KGrnK_Pj7uXixYYQAJphcXLr_xSQv3PMUlcU,792
60
- ramifice/paladins/groups/choice_group.py,sha256=VcoPrTHTu9rcY4k6-dWHqBDE2zOHEIoLIKjG6-9dSps,1728
60
+ ramifice/paladins/groups/choice_group.py,sha256=NsOdPMHtnK-ITnSQxEteCeTFhk7MrJJ3wIcDEeOgodU,1791
61
61
  ramifice/paladins/groups/date_group.py,sha256=B9usKKrHX16F1ckik60Xkub1tawgNENSHTk5Rt-K96k,3741
62
62
  ramifice/paladins/groups/file_group.py,sha256=-xgtrLOTlKXc71Mnbu3I_LbYnTEd8OprnhtYcJbaDtg,2932
63
63
  ramifice/paladins/groups/id_group.py,sha256=q5BeoM1e7mZmX0zVgemva9K-9ihJKBrX8kxvMh-uhhQ,1268
@@ -70,7 +70,7 @@ 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=JBPDrkox2ONpqfhBVR-i8gHUeyp0cR5if03Ml1rT9Q0,10980
73
+ ramifice/utils/migration.py,sha256=ol8ysNGBr0wuOwo00ZbbN0U8YKiiYVgyRYja0axdiHM,11059
74
74
  ramifice/utils/tools.py,sha256=sOKzwnvf6vdTNf9r6PKAdw6aB4undat2Z8tzS3M1GnQ,2733
75
75
  ramifice/utils/translations.py,sha256=GNGE0ULAA0aOY5pTxUd3MQW-nVaKvp6BeXWEcsR0s0o,4048
76
76
  ramifice/utils/unit.py,sha256=qJ2SpClsFcMRcwB_ZA-QlrB5T9OinCBiWx5KqQ9vH_A,2266
@@ -79,7 +79,7 @@ ramifice/utils/mixins/add_valid.py,sha256=TLOObedzXNA9eCylfAVbVCqIKE5sV-P5AdIN7a
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.4.9.dist-info/METADATA,sha256=nSJxqklFILcOWassjetiISC2chZ18V7dlbffS-HAcgo,21785
83
- ramifice-0.4.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
- ramifice-0.4.9.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
85
- ramifice-0.4.9.dist-info/RECORD,,
82
+ ramifice-0.4.11.dist-info/METADATA,sha256=wgz9BoK-X9H0JftAf608T2qd8nBKBnoC1Q4mlb8rygs,21785
83
+ ramifice-0.4.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
+ ramifice-0.4.11.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
85
+ ramifice-0.4.11.dist-info/RECORD,,