ramifice 0.8.11__py3-none-any.whl → 0.8.12__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.
Files changed (84) hide show
  1. ramifice/__init__.py +16 -1
  2. ramifice/commons/__init__.py +2 -2
  3. ramifice/commons/general.py +11 -11
  4. ramifice/commons/indexes.py +8 -8
  5. ramifice/commons/many.py +10 -6
  6. ramifice/commons/one.py +13 -8
  7. ramifice/commons/tools.py +4 -4
  8. ramifice/commons/unit_manager.py +15 -5
  9. ramifice/fields/__init__.py +1 -1
  10. ramifice/fields/bool_field.py +26 -18
  11. ramifice/fields/choice_float_dyn_field.py +29 -21
  12. ramifice/fields/choice_float_field.py +41 -33
  13. ramifice/fields/choice_float_mult_dyn_field.py +29 -21
  14. ramifice/fields/choice_float_mult_field.py +48 -40
  15. ramifice/fields/choice_int_dyn_field.py +29 -21
  16. ramifice/fields/choice_int_field.py +41 -33
  17. ramifice/fields/choice_int_mult_dyn_field.py +29 -21
  18. ramifice/fields/choice_int_mult_field.py +48 -40
  19. ramifice/fields/choice_text_dyn_field.py +29 -21
  20. ramifice/fields/choice_text_field.py +47 -39
  21. ramifice/fields/choice_text_mult_dyn_field.py +29 -21
  22. ramifice/fields/choice_text_mult_field.py +48 -40
  23. ramifice/fields/color_field.py +40 -32
  24. ramifice/fields/date_field.py +49 -40
  25. ramifice/fields/date_time_field.py +49 -40
  26. ramifice/fields/email_field.py +42 -34
  27. ramifice/fields/file_field.py +45 -35
  28. ramifice/fields/float_field.py +56 -47
  29. ramifice/fields/general/__init__.py +1 -1
  30. ramifice/fields/general/choice_group.py +2 -2
  31. ramifice/fields/general/date_group.py +2 -2
  32. ramifice/fields/general/field.py +2 -2
  33. ramifice/fields/general/file_group.py +2 -2
  34. ramifice/fields/general/number_group.py +2 -2
  35. ramifice/fields/general/text_group.py +3 -3
  36. ramifice/fields/id_field.py +35 -28
  37. ramifice/fields/image_field.py +67 -57
  38. ramifice/fields/integer_field.py +56 -47
  39. ramifice/fields/ip_field.py +41 -34
  40. ramifice/fields/password_field.py +29 -22
  41. ramifice/fields/phone_field.py +44 -36
  42. ramifice/fields/slug_field.py +30 -22
  43. ramifice/fields/text_field.py +43 -35
  44. ramifice/fields/url_field.py +40 -33
  45. ramifice/models/__init__.py +1 -1
  46. ramifice/models/decorator.py +33 -11
  47. ramifice/models/model.py +16 -16
  48. ramifice/paladins/__init__.py +2 -2
  49. ramifice/paladins/check.py +8 -3
  50. ramifice/paladins/delete.py +9 -3
  51. ramifice/paladins/groups/__init__.py +1 -1
  52. ramifice/paladins/groups/bool_group.py +3 -3
  53. ramifice/paladins/groups/choice_group.py +3 -3
  54. ramifice/paladins/groups/date_group.py +3 -3
  55. ramifice/paladins/groups/file_group.py +3 -3
  56. ramifice/paladins/groups/id_group.py +3 -3
  57. ramifice/paladins/groups/img_group.py +3 -3
  58. ramifice/paladins/groups/num_group.py +3 -3
  59. ramifice/paladins/groups/pass_group.py +3 -3
  60. ramifice/paladins/groups/slug_group.py +8 -3
  61. ramifice/paladins/groups/text_group.py +3 -3
  62. ramifice/paladins/password.py +11 -4
  63. ramifice/paladins/refrash.py +7 -3
  64. ramifice/paladins/save.py +9 -3
  65. ramifice/paladins/tools.py +11 -6
  66. ramifice/paladins/validation.py +4 -4
  67. ramifice/utils/__init__.py +1 -1
  68. ramifice/utils/constants.py +1 -1
  69. ramifice/utils/errors.py +7 -7
  70. ramifice/utils/fixtures.py +7 -2
  71. ramifice/utils/migration.py +18 -9
  72. ramifice/utils/mixins/__init__.py +1 -1
  73. ramifice/utils/mixins/add_valid.py +3 -3
  74. ramifice/utils/mixins/hooks.py +8 -8
  75. ramifice/utils/mixins/indexing.py +3 -3
  76. ramifice/utils/mixins/json_converter.py +6 -6
  77. ramifice/utils/tools.py +12 -12
  78. ramifice/utils/translations.py +8 -4
  79. ramifice/utils/unit.py +8 -3
  80. {ramifice-0.8.11.dist-info → ramifice-0.8.12.dist-info}/METADATA +1 -1
  81. ramifice-0.8.12.dist-info/RECORD +84 -0
  82. ramifice-0.8.11.dist-info/RECORD +0 -84
  83. {ramifice-0.8.11.dist-info → ramifice-0.8.12.dist-info}/WHEEL +0 -0
  84. {ramifice-0.8.11.dist-info → ramifice-0.8.12.dist-info}/licenses/LICENSE +0 -0
@@ -1,18 +1,22 @@
1
- """Field of Model.
1
+ """Ramifice - Field of Model.
2
2
 
3
3
  Type of selective float field with static of elements.
4
4
  """
5
5
 
6
6
  __all__ = ("ChoiceFloatField",)
7
7
 
8
+ import logging
9
+
8
10
  from ramifice.fields.general.choice_group import ChoiceGroup
9
11
  from ramifice.fields.general.field import Field
10
12
  from ramifice.utils import constants
11
13
  from ramifice.utils.mixins.json_converter import JsonMixin
12
14
 
15
+ logger = logging.getLogger(__name__)
16
+
13
17
 
14
18
  class ChoiceFloatField(Field, ChoiceGroup, JsonMixin):
15
- """Field of Model.
19
+ """Ramifice - Field of Model.
16
20
 
17
21
  Type of selective integer float with static of elements.
18
22
  With a single choice.
@@ -54,41 +58,45 @@ class ChoiceFloatField(Field, ChoiceGroup, JsonMixin):
54
58
  self.choices = choices
55
59
 
56
60
  if constants.DEBUG:
57
- if choices is not None:
58
- if not isinstance(choices, list):
59
- raise AssertionError("Parameter `choices` - Not а `list` type!")
60
- if len(choices) == 0:
61
+ try:
62
+ if choices is not None:
63
+ if not isinstance(choices, list):
64
+ raise AssertionError("Parameter `choices` - Not а `list` type!")
65
+ if len(choices) == 0:
66
+ raise AssertionError(
67
+ "The `choices` parameter should not contain an empty list!"
68
+ )
69
+ if default is not None and not isinstance(default, float):
70
+ raise AssertionError("Parameter `default` - Not а `float` type!")
71
+ if default is not None and choices is not None and not self.has_value():
61
72
  raise AssertionError(
62
- "The `choices` parameter should not contain an empty list!"
73
+ "Parameter `default` does not coincide with "
74
+ + "list of permissive values in `choicees`."
63
75
  )
64
- if default is not None and not isinstance(default, float):
65
- raise AssertionError("Parameter `default` - Not а `float` type!")
66
- if default is not None and choices is not None and not self.has_value():
67
- raise AssertionError(
68
- "Parameter `default` does not coincide with "
69
- + "list of permissive values in `choicees`."
70
- )
71
- if not isinstance(label, str):
72
- raise AssertionError("Parameter `default` - Not а `str` type!")
73
- if not isinstance(disabled, bool):
74
- raise AssertionError("Parameter `disabled` - Not а `bool` type!")
75
- if not isinstance(hide, bool):
76
- raise AssertionError("Parameter `hide` - Not а `bool` type!")
77
- if not isinstance(ignored, bool):
78
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
79
- if not isinstance(ignored, bool):
80
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
81
- if not isinstance(hint, str):
82
- raise AssertionError("Parameter `hint` - Not а `str` type!")
83
- if warning is not None and not isinstance(warning, list):
84
- raise AssertionError("Parameter `warning` - Not а `list` type!")
85
- if not isinstance(required, bool):
86
- raise AssertionError("Parameter `required` - Not а `bool` type!")
87
- if not isinstance(readonly, bool):
88
- raise AssertionError("Parameter `readonly` - Not а `bool` type!")
76
+ if not isinstance(label, str):
77
+ raise AssertionError("Parameter `default` - Not а `str` type!")
78
+ if not isinstance(disabled, bool):
79
+ raise AssertionError("Parameter `disabled` - Not а `bool` type!")
80
+ if not isinstance(hide, bool):
81
+ raise AssertionError("Parameter `hide` - Not а `bool` type!")
82
+ if not isinstance(ignored, bool):
83
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
84
+ if not isinstance(ignored, bool):
85
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
86
+ if not isinstance(hint, str):
87
+ raise AssertionError("Parameter `hint` - Not а `str` type!")
88
+ if warning is not None and not isinstance(warning, list):
89
+ raise AssertionError("Parameter `warning` - Not а `list` type!")
90
+ if not isinstance(required, bool):
91
+ raise AssertionError("Parameter `required` - Not а `bool` type!")
92
+ if not isinstance(readonly, bool):
93
+ raise AssertionError("Parameter `readonly` - Not а `bool` type!")
94
+ except AssertionError as err:
95
+ logger.error(str(err))
96
+ raise err
89
97
 
90
98
  def has_value(self, is_migrate: bool = False) -> bool:
91
- """Does the field value match the possible options in choices."""
99
+ """Ramifice - Does the field value match the possible options in choices."""
92
100
  value = self.value
93
101
  if value is None:
94
102
  value = self.default
@@ -1,18 +1,22 @@
1
- """Field of Model.
1
+ """Ramifice - Field of Model.
2
2
 
3
3
  Type of selective float field with dynamic addition of elements.
4
4
  """
5
5
 
6
6
  __all__ = ("ChoiceFloatMultDynField",)
7
7
 
8
+ import logging
9
+
8
10
  from ramifice.fields.general.choice_group import ChoiceGroup
9
11
  from ramifice.fields.general.field import Field
10
12
  from ramifice.utils import constants
11
13
  from ramifice.utils.mixins.json_converter import JsonMixin
12
14
 
15
+ logger = logging.getLogger(__name__)
16
+
13
17
 
14
18
  class ChoiceFloatMultDynField(Field, ChoiceGroup, JsonMixin):
15
- """Field of Model.
19
+ """Ramifice - Field of Model.
16
20
 
17
21
  Type of selective float field with dynamic addition of elements.
18
22
  For simulate relationship Many-to-Many.
@@ -30,24 +34,28 @@ class ChoiceFloatMultDynField(Field, ChoiceGroup, JsonMixin):
30
34
  readonly: bool = False,
31
35
  ):
32
36
  if constants.DEBUG:
33
- if not isinstance(label, str):
34
- raise AssertionError("Parameter `default` - Not а `str` type!")
35
- if not isinstance(disabled, bool):
36
- raise AssertionError("Parameter `disabled` - Not а `bool` type!")
37
- if not isinstance(hide, bool):
38
- raise AssertionError("Parameter `hide` - Not а `bool` type!")
39
- if not isinstance(ignored, bool):
40
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
41
- if not isinstance(ignored, bool):
42
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
43
- if not isinstance(hint, str):
44
- raise AssertionError("Parameter `hint` - Not а `str` type!")
45
- if warning is not None and not isinstance(warning, list):
46
- raise AssertionError("Parameter `warning` - Not а `list` type!")
47
- if not isinstance(required, bool):
48
- raise AssertionError("Parameter `required` - Not а `bool` type!")
49
- if not isinstance(readonly, bool):
50
- raise AssertionError("Parameter `readonly` - Not а `bool` type!")
37
+ try:
38
+ if not isinstance(label, str):
39
+ raise AssertionError("Parameter `default` - Not а `str` type!")
40
+ if not isinstance(disabled, bool):
41
+ raise AssertionError("Parameter `disabled` - Not а `bool` type!")
42
+ if not isinstance(hide, bool):
43
+ raise AssertionError("Parameter `hide` - Not а `bool` type!")
44
+ if not isinstance(ignored, bool):
45
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
46
+ if not isinstance(ignored, bool):
47
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
48
+ if not isinstance(hint, str):
49
+ raise AssertionError("Parameter `hint` - Not а `str` type!")
50
+ if warning is not None and not isinstance(warning, list):
51
+ raise AssertionError("Parameter `warning` - Not а `list` type!")
52
+ if not isinstance(required, bool):
53
+ raise AssertionError("Parameter `required` - Not а `bool` type!")
54
+ if not isinstance(readonly, bool):
55
+ raise AssertionError("Parameter `readonly` - Not а `bool` type!")
56
+ except AssertionError as err:
57
+ logger.error(str(err))
58
+ raise err
51
59
 
52
60
  Field.__init__(
53
61
  self,
@@ -72,7 +80,7 @@ class ChoiceFloatMultDynField(Field, ChoiceGroup, JsonMixin):
72
80
  self.choices: list[list[float | str]] | None = None
73
81
 
74
82
  def has_value(self, is_migrate: bool = False) -> bool:
75
- """Does the field value match the possible options in choices."""
83
+ """Ramifice - Does the field value match the possible options in choices."""
76
84
  if is_migrate:
77
85
  return True
78
86
  value = self.value
@@ -1,18 +1,22 @@
1
- """Field of Model.
1
+ """Ramifice - Field of Model.
2
2
 
3
3
  Type of selective float field with static of elements.
4
4
  """
5
5
 
6
6
  __all__ = ("ChoiceFloatMultField",)
7
7
 
8
+ import logging
9
+
8
10
  from ramifice.fields.general.choice_group import ChoiceGroup
9
11
  from ramifice.fields.general.field import Field
10
12
  from ramifice.utils import constants
11
13
  from ramifice.utils.mixins.json_converter import JsonMixin
12
14
 
15
+ logger = logging.getLogger(__name__)
16
+
13
17
 
14
18
  class ChoiceFloatMultField(Field, ChoiceGroup, JsonMixin):
15
- """Field of Model.
19
+ """Ramifice - Field of Model.
16
20
 
17
21
  Type of selective float field with static of elements.
18
22
  With multiple choice.
@@ -55,46 +59,50 @@ class ChoiceFloatMultField(Field, ChoiceGroup, JsonMixin):
55
59
  self.choices = choices
56
60
 
57
61
  if constants.DEBUG:
58
- if choices is not None:
59
- if not isinstance(choices, list):
60
- raise AssertionError("Parameter `choices` - Not а `list` type!")
61
- if len(choices) == 0:
62
- raise AssertionError(
63
- "The `choices` parameter should not contain an empty list!"
64
- )
65
- if default is not None:
66
- if not isinstance(default, list):
67
- raise AssertionError("Parameter `default` - Not а `list` type!")
68
- if len(default) == 0:
69
- raise AssertionError(
70
- "The `default` parameter should not contain an empty list!"
71
- )
72
- if choices is not None and not self.has_value():
73
- raise AssertionError(
74
- "Parameter `default` does not coincide with "
75
- + "list of permissive values in `choicees`."
76
- )
77
- if not isinstance(label, str):
78
- raise AssertionError("Parameter `default` - Not а `str` type!")
79
- if not isinstance(disabled, bool):
80
- raise AssertionError("Parameter `disabled` - Not а `bool` type!")
81
- if not isinstance(hide, bool):
82
- raise AssertionError("Parameter `hide` - Not а `bool` type!")
83
- if not isinstance(ignored, bool):
84
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
85
- if not isinstance(ignored, bool):
86
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
87
- if not isinstance(hint, str):
88
- raise AssertionError("Parameter `hint` - Not а `str` type!")
89
- if warning is not None and not isinstance(warning, list):
90
- raise AssertionError("Parameter `warning` - Not а `list` type!")
91
- if not isinstance(required, bool):
92
- raise AssertionError("Parameter `required` - Not а `bool` type!")
93
- if not isinstance(readonly, bool):
94
- raise AssertionError("Parameter `readonly` - Not а `bool` type!")
62
+ try:
63
+ if choices is not None:
64
+ if not isinstance(choices, list):
65
+ raise AssertionError("Parameter `choices` - Not а `list` type!")
66
+ if len(choices) == 0:
67
+ raise AssertionError(
68
+ "The `choices` parameter should not contain an empty list!"
69
+ )
70
+ if default is not None:
71
+ if not isinstance(default, list):
72
+ raise AssertionError("Parameter `default` - Not а `list` type!")
73
+ if len(default) == 0:
74
+ raise AssertionError(
75
+ "The `default` parameter should not contain an empty list!"
76
+ )
77
+ if choices is not None and not self.has_value():
78
+ raise AssertionError(
79
+ "Parameter `default` does not coincide with "
80
+ + "list of permissive values in `choicees`."
81
+ )
82
+ if not isinstance(label, str):
83
+ raise AssertionError("Parameter `default` - Not а `str` type!")
84
+ if not isinstance(disabled, bool):
85
+ raise AssertionError("Parameter `disabled` - Not а `bool` type!")
86
+ if not isinstance(hide, bool):
87
+ raise AssertionError("Parameter `hide` - Not а `bool` type!")
88
+ if not isinstance(ignored, bool):
89
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
90
+ if not isinstance(ignored, bool):
91
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
92
+ if not isinstance(hint, str):
93
+ raise AssertionError("Parameter `hint` - Not а `str` type!")
94
+ if warning is not None and not isinstance(warning, list):
95
+ raise AssertionError("Parameter `warning` - Not а `list` type!")
96
+ if not isinstance(required, bool):
97
+ raise AssertionError("Parameter `required` - Not а `bool` type!")
98
+ if not isinstance(readonly, bool):
99
+ raise AssertionError("Parameter `readonly` - Not а `bool` type!")
100
+ except AssertionError as err:
101
+ logger.error(str(err))
102
+ raise err
95
103
 
96
104
  def has_value(self, is_migrate: bool = False) -> bool:
97
- """Does the field value match the possible options in choices."""
105
+ """Ramifice - Does the field value match the possible options in choices."""
98
106
  value = self.value
99
107
  if value is None:
100
108
  value = self.default
@@ -1,18 +1,22 @@
1
- """Field of Model.
1
+ """Ramifice - Field of Model.
2
2
 
3
3
  Type of selective integer field with dynamic addition of elements.
4
4
  """
5
5
 
6
6
  __all__ = ("ChoiceIntDynField",)
7
7
 
8
+ import logging
9
+
8
10
  from ramifice.fields.general.choice_group import ChoiceGroup
9
11
  from ramifice.fields.general.field import Field
10
12
  from ramifice.utils import constants
11
13
  from ramifice.utils.mixins.json_converter import JsonMixin
12
14
 
15
+ logger = logging.getLogger(__name__)
16
+
13
17
 
14
18
  class ChoiceIntDynField(Field, ChoiceGroup, JsonMixin):
15
- """Field of Model.
19
+ """Ramifice - Field of Model.
16
20
 
17
21
  Type of selective integer field with dynamic addition of elements.
18
22
  For simulate relationship Many-to-One.
@@ -31,24 +35,28 @@ class ChoiceIntDynField(Field, ChoiceGroup, JsonMixin):
31
35
  readonly: bool = False,
32
36
  ):
33
37
  if constants.DEBUG:
34
- if not isinstance(label, str):
35
- raise AssertionError("Parameter `default` - Not а `str` type!")
36
- if not isinstance(disabled, bool):
37
- raise AssertionError("Parameter `disabled` - Not а `bool` type!")
38
- if not isinstance(hide, bool):
39
- raise AssertionError("Parameter `hide` - Not а `bool` type!")
40
- if not isinstance(ignored, bool):
41
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
42
- if not isinstance(ignored, bool):
43
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
44
- if not isinstance(hint, str):
45
- raise AssertionError("Parameter `hint` - Not а `str` type!")
46
- if warning is not None and not isinstance(warning, list):
47
- raise AssertionError("Parameter `warning` - Not а `list` type!")
48
- if not isinstance(required, bool):
49
- raise AssertionError("Parameter `required` - Not а `bool` type!")
50
- if not isinstance(readonly, bool):
51
- raise AssertionError("Parameter `readonly` - Not а `bool` type!")
38
+ try:
39
+ if not isinstance(label, str):
40
+ raise AssertionError("Parameter `default` - Not а `str` type!")
41
+ if not isinstance(disabled, bool):
42
+ raise AssertionError("Parameter `disabled` - Not а `bool` type!")
43
+ if not isinstance(hide, bool):
44
+ raise AssertionError("Parameter `hide` - Not а `bool` type!")
45
+ if not isinstance(ignored, bool):
46
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
47
+ if not isinstance(ignored, bool):
48
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
49
+ if not isinstance(hint, str):
50
+ raise AssertionError("Parameter `hint` - Not а `str` type!")
51
+ if warning is not None and not isinstance(warning, list):
52
+ raise AssertionError("Parameter `warning` - Not а `list` type!")
53
+ if not isinstance(required, bool):
54
+ raise AssertionError("Parameter `required` - Not а `bool` type!")
55
+ if not isinstance(readonly, bool):
56
+ raise AssertionError("Parameter `readonly` - Not а `bool` type!")
57
+ except AssertionError as err:
58
+ logger.error(str(err))
59
+ raise err
52
60
 
53
61
  Field.__init__(
54
62
  self,
@@ -72,7 +80,7 @@ class ChoiceIntDynField(Field, ChoiceGroup, JsonMixin):
72
80
  self.choices: list[list[int | str]] | None = None
73
81
 
74
82
  def has_value(self, is_migrate: bool = False) -> bool:
75
- """Does the field value match the possible options in choices."""
83
+ """Ramifice - Does the field value match the possible options in choices."""
76
84
  if is_migrate:
77
85
  return True
78
86
  value = self.value
@@ -1,18 +1,22 @@
1
- """Field of Model.
1
+ """Ramifice - Field of Model.
2
2
 
3
3
  Type of selective integer field with static of elements.
4
4
  """
5
5
 
6
6
  __all__ = ("ChoiceIntField",)
7
7
 
8
+ import logging
9
+
8
10
  from ramifice.fields.general.choice_group import ChoiceGroup
9
11
  from ramifice.fields.general.field import Field
10
12
  from ramifice.utils import constants
11
13
  from ramifice.utils.mixins.json_converter import JsonMixin
12
14
 
15
+ logger = logging.getLogger(__name__)
16
+
13
17
 
14
18
  class ChoiceIntField(Field, ChoiceGroup, JsonMixin):
15
- """Field of Model.
19
+ """Ramifice - Field of Model.
16
20
 
17
21
  Type of selective integer field with static of elements.
18
22
  With a single choice.
@@ -54,41 +58,45 @@ class ChoiceIntField(Field, ChoiceGroup, JsonMixin):
54
58
  self.choices = choices
55
59
 
56
60
  if constants.DEBUG:
57
- if choices is not None:
58
- if not isinstance(choices, list):
59
- raise AssertionError("Parameter `choices` - Not а `list` type!")
60
- if len(choices) == 0:
61
+ try:
62
+ if choices is not None:
63
+ if not isinstance(choices, list):
64
+ raise AssertionError("Parameter `choices` - Not а `list` type!")
65
+ if len(choices) == 0:
66
+ raise AssertionError(
67
+ "The `choices` parameter should not contain an empty list!"
68
+ )
69
+ if default is not None and not isinstance(default, int):
70
+ raise AssertionError("Parameter `default` - Not а `str` type!")
71
+ if default is not None and choices is not None and not self.has_value():
61
72
  raise AssertionError(
62
- "The `choices` parameter should not contain an empty list!"
73
+ "Parameter `default` does not coincide with "
74
+ + "list of permissive values in `choicees`."
63
75
  )
64
- if default is not None and not isinstance(default, int):
65
- raise AssertionError("Parameter `default` - Not а `str` type!")
66
- if default is not None and choices is not None and not self.has_value():
67
- raise AssertionError(
68
- "Parameter `default` does not coincide with "
69
- + "list of permissive values in `choicees`."
70
- )
71
- if not isinstance(label, str):
72
- raise AssertionError("Parameter `default` - Not а `str` type!")
73
- if not isinstance(disabled, bool):
74
- raise AssertionError("Parameter `disabled` - Not а `bool` type!")
75
- if not isinstance(hide, bool):
76
- raise AssertionError("Parameter `hide` - Not а `bool` type!")
77
- if not isinstance(ignored, bool):
78
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
79
- if not isinstance(ignored, bool):
80
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
81
- if not isinstance(hint, str):
82
- raise AssertionError("Parameter `hint` - Not а `str` type!")
83
- if warning is not None and not isinstance(warning, list):
84
- raise AssertionError("Parameter `warning` - Not а `list` type!")
85
- if not isinstance(required, bool):
86
- raise AssertionError("Parameter `required` - Not а `bool` type!")
87
- if not isinstance(readonly, bool):
88
- raise AssertionError("Parameter `readonly` - Not а `bool` type!")
76
+ if not isinstance(label, str):
77
+ raise AssertionError("Parameter `default` - Not а `str` type!")
78
+ if not isinstance(disabled, bool):
79
+ raise AssertionError("Parameter `disabled` - Not а `bool` type!")
80
+ if not isinstance(hide, bool):
81
+ raise AssertionError("Parameter `hide` - Not а `bool` type!")
82
+ if not isinstance(ignored, bool):
83
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
84
+ if not isinstance(ignored, bool):
85
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
86
+ if not isinstance(hint, str):
87
+ raise AssertionError("Parameter `hint` - Not а `str` type!")
88
+ if warning is not None and not isinstance(warning, list):
89
+ raise AssertionError("Parameter `warning` - Not а `list` type!")
90
+ if not isinstance(required, bool):
91
+ raise AssertionError("Parameter `required` - Not а `bool` type!")
92
+ if not isinstance(readonly, bool):
93
+ raise AssertionError("Parameter `readonly` - Not а `bool` type!")
94
+ except AssertionError as err:
95
+ logger.error(str(err))
96
+ raise err
89
97
 
90
98
  def has_value(self, is_migrate: bool = False) -> bool:
91
- """Does the field value match the possible options in choices."""
99
+ """Ramifice - Does the field value match the possible options in choices."""
92
100
  value = self.value
93
101
  if value is None:
94
102
  value = self.default
@@ -1,18 +1,22 @@
1
- """Field of Model.
1
+ """Ramifice - Field of Model.
2
2
 
3
3
  Type of selective integer field with dynamic addition of elements.
4
4
  """
5
5
 
6
6
  __all__ = ("ChoiceIntMultDynField",)
7
7
 
8
+ import logging
9
+
8
10
  from ramifice.fields.general.choice_group import ChoiceGroup
9
11
  from ramifice.fields.general.field import Field
10
12
  from ramifice.utils import constants
11
13
  from ramifice.utils.mixins.json_converter import JsonMixin
12
14
 
15
+ logger = logging.getLogger(__name__)
16
+
13
17
 
14
18
  class ChoiceIntMultDynField(Field, ChoiceGroup, JsonMixin):
15
- """Field of Model.
19
+ """Ramifice - Field of Model.
16
20
 
17
21
  Type of selective integer field with dynamic addition of elements.
18
22
  For simulate relationship Many-to-Many.
@@ -30,24 +34,28 @@ class ChoiceIntMultDynField(Field, ChoiceGroup, JsonMixin):
30
34
  readonly: bool = False,
31
35
  ):
32
36
  if constants.DEBUG:
33
- if not isinstance(label, str):
34
- raise AssertionError("Parameter `default` - Not а `str` type!")
35
- if not isinstance(disabled, bool):
36
- raise AssertionError("Parameter `disabled` - Not а `bool` type!")
37
- if not isinstance(hide, bool):
38
- raise AssertionError("Parameter `hide` - Not а `bool` type!")
39
- if not isinstance(ignored, bool):
40
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
41
- if not isinstance(ignored, bool):
42
- raise AssertionError("Parameter `ignored` - Not а `bool` type!")
43
- if not isinstance(hint, str):
44
- raise AssertionError("Parameter `hint` - Not а `str` type!")
45
- if warning is not None and not isinstance(warning, list):
46
- raise AssertionError("Parameter `warning` - Not а `list` type!")
47
- if not isinstance(required, bool):
48
- raise AssertionError("Parameter `required` - Not а `bool` type!")
49
- if not isinstance(readonly, bool):
50
- raise AssertionError("Parameter `readonly` - Not а `bool` type!")
37
+ try:
38
+ if not isinstance(label, str):
39
+ raise AssertionError("Parameter `default` - Not а `str` type!")
40
+ if not isinstance(disabled, bool):
41
+ raise AssertionError("Parameter `disabled` - Not а `bool` type!")
42
+ if not isinstance(hide, bool):
43
+ raise AssertionError("Parameter `hide` - Not а `bool` type!")
44
+ if not isinstance(ignored, bool):
45
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
46
+ if not isinstance(ignored, bool):
47
+ raise AssertionError("Parameter `ignored` - Not а `bool` type!")
48
+ if not isinstance(hint, str):
49
+ raise AssertionError("Parameter `hint` - Not а `str` type!")
50
+ if warning is not None and not isinstance(warning, list):
51
+ raise AssertionError("Parameter `warning` - Not а `list` type!")
52
+ if not isinstance(required, bool):
53
+ raise AssertionError("Parameter `required` - Not а `bool` type!")
54
+ if not isinstance(readonly, bool):
55
+ raise AssertionError("Parameter `readonly` - Not а `bool` type!")
56
+ except AssertionError as err:
57
+ logger.error(str(err))
58
+ raise err
51
59
 
52
60
  Field.__init__(
53
61
  self,
@@ -72,7 +80,7 @@ class ChoiceIntMultDynField(Field, ChoiceGroup, JsonMixin):
72
80
  self.choices: list[list[int | str]] | None = None
73
81
 
74
82
  def has_value(self, is_migrate: bool = False) -> bool:
75
- """Does the field value match the possible options in choices."""
83
+ """Ramifice - Does the field value match the possible options in choices."""
76
84
  if is_migrate:
77
85
  return True
78
86
  value = self.value