ramifice 0.8.16__py3-none-any.whl → 0.8.17__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/models/model.py CHANGED
@@ -190,10 +190,12 @@ class Model(metaclass=ABCMeta):
190
190
  self.__dict__[name].value = value
191
191
 
192
192
  # --------------------------------------------------------------------------
193
- def get_clean_data(self) -> dict[str, Any]:
193
+ def get_clean_data(self) -> tuple[dict[str, Any], dict[str, str]]:
194
194
  """Get clean data."""
195
195
  clean_data: dict[str, Any] = {}
196
+
196
197
  for name, data in self.__dict__.items():
197
198
  if not callable(data):
198
199
  clean_data[name] = data.value
199
- return clean_data
200
+
201
+ return (clean_data, {})
@@ -65,7 +65,7 @@ class CheckMixin(
65
65
 
66
66
  result_map: dict[str, Any] = {}
67
67
  # Errors from additional validation of fields.
68
- error_map: dict[str, str] = await self.add_validation() or {}
68
+ error_map: dict[str, str] = await self.add_validation()
69
69
  # Get Model collection.
70
70
  if collection is None:
71
71
  collection = constants.MONGO_DATABASE[cls_model.META["collection_name"]]
@@ -10,5 +10,4 @@ class AddValidMixin(metaclass=ABCMeta):
10
10
 
11
11
  async def add_validation(self) -> dict[str, str]:
12
12
  """Ramifice - Additional validation of fields."""
13
- error_map: dict[str, str] = {}
14
- return error_map
13
+ return {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ramifice
3
- Version: 0.8.16
3
+ Version: 0.8.17
4
4
  Summary: ORM-pseudo-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/
@@ -192,19 +192,16 @@ class User:
192
192
  async def add_validation(self) -> dict[str, str]:
193
193
  """Additional validation of fields."""
194
194
  gettext = translations.gettext
195
- error_map: dict[str, str] = {}
196
-
197
- # Get clean data
198
- cd: dict[str, Any] = self.get_clean_data()
195
+ cd, err_map = self.get_clean_data()
199
196
 
200
197
  # Check username
201
198
  if re.match(r"^[a-zA-Z0-9_]+$", cd["username"]) is None:
202
- error_map["username"] = gettext("Allowed chars: %s") % "a-z A-Z 0-9 _"
199
+ err_map["username"] = gettext("Allowed chars: %s") % "a-z A-Z 0-9 _"
203
200
 
204
201
  # Check password
205
- if cd["id"] is None and (cd["password"] != cd["сonfirm_password"]):
206
- error_map["password"] = gettext("Passwords do not match!")
207
- return error_map
202
+ if cd["_id"] is None and (cd["password"] != cd["сonfirm_password"]):
203
+ err_map["password"] = gettext("Passwords do not match!")
204
+ return err_map
208
205
 
209
206
 
210
207
  async def main():
@@ -45,9 +45,9 @@ ramifice/fields/general/number_group.py,sha256=jspiA9hWiU_hNhXbTku2rZG3UezrhEVBG
45
45
  ramifice/fields/general/text_group.py,sha256=hYVX4-ipD2_eyj-WpHIHnFrpQevySaVd4twffUsrOLo,1164
46
46
  ramifice/models/__init__.py,sha256=y5jRhSzcPuEVUWr1u--o1GyjFb7irlf5Rn2gPvQ3IPg,26
47
47
  ramifice/models/decorator.py,sha256=PX6b8DTP_Qz1SjyPcZ1vGDS4AGRZ6ZD8z8y6497j-DM,6685
48
- ramifice/models/model.py,sha256=Q2FG0zBNCIPEQZXLEj_l2kB-6LT0acFKoBVU7hYiDPE,7717
48
+ ramifice/models/model.py,sha256=ufBWkAHvZjP3kN9x-VMPVq7k6vHhxcTvECV-BvaP6dc,7750
49
49
  ramifice/paladins/__init__.py,sha256=I2FzvCrp6upv_GPLfDqaVLwIT6-3Dp_K9i51tFUXDuc,673
50
- ramifice/paladins/check.py,sha256=mxvnHR9EG7eQrGOE7wph1lCUq3jf2RF0Ovhhtz7W3g8,6974
50
+ ramifice/paladins/check.py,sha256=L7mYsN5qp6ZlGiyPBQK1jw4GN03aIh8QpbbdK6-n6S4,6968
51
51
  ramifice/paladins/delete.py,sha256=Ynew5zvEBRJNmss5I8hSIp7KgBHpSvDEJCwOfMH5MUU,3723
52
52
  ramifice/paladins/password.py,sha256=hdEfSwz0a9FJ5IIYpyD9bmV_kNGvXP4OV5Ea-V0Yx98,3341
53
53
  ramifice/paladins/refrash.py,sha256=0qst0ii2ThH-VJduSI1zgkuZQGLnR8IiIu5rTVxzM9U,1254
@@ -74,11 +74,11 @@ ramifice/utils/tools.py,sha256=LZyA715HnkNO7TcBu4Ia29A6Ko3n-F2BRULzIyNKt9o,3279
74
74
  ramifice/utils/translations.py,sha256=Jh0nzwcn3bhUU2TjPAQboe3_pkVyhYQYdeINyC5SQo8,4701
75
75
  ramifice/utils/unit.py,sha256=ToBeu92tzOY32fuzLdxScNeYXvGIDr0nx7yTv2DShVo,2604
76
76
  ramifice/utils/mixins/__init__.py,sha256=fTsjH8h4OGvFC4zGawLLbU2i-c2OBdPftC3A-ZT5Pbw,379
77
- ramifice/utils/mixins/add_valid.py,sha256=vYq4wGdpfA4iLMts7G0NvDALZBwupOScsajDFWCmmYg,472
77
+ ramifice/utils/mixins/add_valid.py,sha256=00eIBlgsUU1TfDo1rUQT5zw7_Iv9IubORTbzuKoVB5o,425
78
78
  ramifice/utils/mixins/hooks.py,sha256=h8coNstWWHI4VwPgpjx0NWTj93-5NDAGtav0VFh-fk4,1031
79
79
  ramifice/utils/mixins/indexing.py,sha256=WVLxmkLKg-C_LHn2hq6LJuOkSr9eS-XUUvCMgK-pKYo,387
80
80
  ramifice/utils/mixins/json_converter.py,sha256=qBqFYol3Pbq1kX33EWB6FsYUL3AGSdYNtQE97HQ9jy4,1225
81
- ramifice-0.8.16.dist-info/METADATA,sha256=ySscCHH2SOY5PCObHgagtPdTrzdwQSeQNYCaj-8GRxU,20961
82
- ramifice-0.8.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
83
- ramifice-0.8.16.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
84
- ramifice-0.8.16.dist-info/RECORD,,
81
+ ramifice-0.8.17.dist-info/METADATA,sha256=gXiqJfKJX6s5dpHEir2eZeU82lhZPdUP9Osf74Ba6BI,20884
82
+ ramifice-0.8.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
83
+ ramifice-0.8.17.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
84
+ ramifice-0.8.17.dist-info/RECORD,,