safeshield 1.4.7__py3-none-any.whl → 1.4.9__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.
Potentially problematic release.
This version of safeshield might be problematic. Click here for more details.
- {safeshield-1.4.7.dist-info → safeshield-1.4.9.dist-info}/METADATA +1 -1
- {safeshield-1.4.7.dist-info → safeshield-1.4.9.dist-info}/RECORD +6 -6
- validator/factory.py +12 -3
- {safeshield-1.4.7.dist-info → safeshield-1.4.9.dist-info}/LICENSE +0 -0
- {safeshield-1.4.7.dist-info → safeshield-1.4.9.dist-info}/WHEEL +0 -0
- {safeshield-1.4.7.dist-info → safeshield-1.4.9.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
validator/__init__.py,sha256=udxDzUicPfxBOAQvzsnl3pHur9VUppKbWMgg35hpiww,244
|
|
2
2
|
validator/exceptions.py,sha256=y2v7CaXmeGFHWcnigtLl4U-sFta_jMiXkGKXWIIVglY,366
|
|
3
|
-
validator/factory.py,sha256=
|
|
3
|
+
validator/factory.py,sha256=RLcNBgGeNf9AUBzyGh9x7UigQBNXKgIJmp4Qsz9KTi8,1149
|
|
4
4
|
validator/core/__init__.py,sha256=ZcqlXJSk03i_CVzmIN-nVe1UOyvwwO5jhbEj7f62Y_o,59
|
|
5
5
|
validator/core/validator.py,sha256=la-kzp82iCii2bq4hV76F-7datWPb27vmyHvpg2itR0,12726
|
|
6
6
|
validator/database/__init__.py,sha256=O-cB6-MhNapJ3iwe5jvifbMfr1dPjXLtEdfNTKIu0hc,171
|
|
@@ -24,8 +24,8 @@ validator/services/rule_error_handler.py,sha256=K6vq-pdVd5e4Xw7cpTguORy3VPWUJQa3
|
|
|
24
24
|
validator/services/rule_preparer.py,sha256=4khRjdely_0Z5mxFwf1bKIid076_xDuNh2XBO_fGerE,4706
|
|
25
25
|
validator/utils/__init__.py,sha256=Yzo-xv285Be-a233M4duDdYtscuHiuBbPSX_C8yViJI,20
|
|
26
26
|
validator/utils/string.py,sha256=0YACzeEaWNEOR9_7O9A8D1ItIbtWfOJ8IfrzcB8VMYA,515
|
|
27
|
-
safeshield-1.4.
|
|
28
|
-
safeshield-1.4.
|
|
29
|
-
safeshield-1.4.
|
|
30
|
-
safeshield-1.4.
|
|
31
|
-
safeshield-1.4.
|
|
27
|
+
safeshield-1.4.9.dist-info/LICENSE,sha256=qugtRyKckyaks6hd2xyxOFSOYM6au1N80pMXuMTPvC4,1090
|
|
28
|
+
safeshield-1.4.9.dist-info/METADATA,sha256=bXDUx3M5GfMVvaE4XxCXpmOabzjD3RUTHqvGFFDgLcM,2313
|
|
29
|
+
safeshield-1.4.9.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
30
|
+
safeshield-1.4.9.dist-info/top_level.txt,sha256=iUtV3dlHOIiMfLuY4pruY00lFni8JzOkQ3Nh1II19OE,10
|
|
31
|
+
safeshield-1.4.9.dist-info/RECORD,,
|
validator/factory.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# factory.py
|
|
2
|
-
from typing import Type, Dict, List
|
|
2
|
+
from typing import Type, Dict, List, Any
|
|
3
3
|
from validator.rules import all_rules
|
|
4
4
|
from validator.rules.base import Rule
|
|
5
5
|
|
|
@@ -14,8 +14,17 @@ class RuleFactory:
|
|
|
14
14
|
raise ValueError(f"Unknown validation rule: {rule_name}")
|
|
15
15
|
|
|
16
16
|
@classmethod
|
|
17
|
-
def register_rule(cls, name: str,
|
|
18
|
-
|
|
17
|
+
def register_rule(cls, name: str, validate_func: callable, message_func: callable):
|
|
18
|
+
class NewRule(Rule):
|
|
19
|
+
_name = name
|
|
20
|
+
|
|
21
|
+
def validate(self, field: str, value: Any, params: List[str]) -> bool:
|
|
22
|
+
return validate_func(field, value, params)
|
|
23
|
+
|
|
24
|
+
def message(self, field: str) -> str:
|
|
25
|
+
return message_func(field, self.params)
|
|
26
|
+
|
|
27
|
+
cls._rules[name] = NewRule
|
|
19
28
|
|
|
20
29
|
@classmethod
|
|
21
30
|
def has_rule(cls, rule_name: str) -> bool:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|