clear-skies 1.22.6__py3-none-any.whl → 1.22.8__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 clear-skies might be problematic. Click here for more details.
- {clear_skies-1.22.6.dist-info → clear_skies-1.22.8.dist-info}/METADATA +1 -1
- {clear_skies-1.22.6.dist-info → clear_skies-1.22.8.dist-info}/RECORD +8 -8
- clearskies/column_types/has_many.py +17 -16
- clearskies/di/additional_config.py +3 -0
- clearskies/di/di.py +1 -1
- clearskies/di/standard_dependencies.py +3 -1
- {clear_skies-1.22.6.dist-info → clear_skies-1.22.8.dist-info}/LICENSE +0 -0
- {clear_skies-1.22.6.dist-info → clear_skies-1.22.8.dist-info}/WHEEL +0 -0
|
@@ -74,7 +74,7 @@ clearskies/column_types/datetime.py,sha256=xtuZpUC9fA16i1oO80kPIx--8RDPuei9RdsDD
|
|
|
74
74
|
clearskies/column_types/datetime_micro.py,sha256=ewQSniCc2MmNIyX2XNuNcCIwh5Fpf1HcvpLfzB8lz8g,382
|
|
75
75
|
clearskies/column_types/email.py,sha256=qq0Yo_C3KxUqT68q2HWXocBBR4xwMqjxcIdgZRv218U,584
|
|
76
76
|
clearskies/column_types/float.py,sha256=j8jJeBueSOusPtAFCWgLHYBncfLnqT1U7bh1zcAkYiA,1332
|
|
77
|
-
clearskies/column_types/has_many.py,sha256=
|
|
77
|
+
clearskies/column_types/has_many.py,sha256=PLIz3btk1PrpVFiys6iJb0Mq-i-V8NUP0Vy7hnkNN08,7559
|
|
78
78
|
clearskies/column_types/has_one.py,sha256=uphIPUuHLwwmhljLMaKKPujR6TYTT7onn-hHUF6S_IY,2230
|
|
79
79
|
clearskies/column_types/integer.py,sha256=dGIluusPmhLRNg7PplOJLbQI2AXojqRBUHt8ekYWNVI,1386
|
|
80
80
|
clearskies/column_types/json.py,sha256=TbZkdwCoZYhbALUxof2jENGfaq2i5TlcyBcmo7XzDGQ,652
|
|
@@ -119,10 +119,10 @@ clearskies/decorators/schema.py,sha256=X7TEqIA_bzq0MYeEQ84xbcFSbZnKO6tG22466xUE0
|
|
|
119
119
|
clearskies/decorators/secret_bearer.py,sha256=iytP9fsTbxzLl-KtgG9-23iwNImusJlfCHuUY__pJ-U,772
|
|
120
120
|
clearskies/decorators/security_headers.py,sha256=Spk53FL4epHDSLQeGNTWO9R6QC63psqAThHM-xGGuj0,269
|
|
121
121
|
clearskies/di/__init__.py,sha256=T7SgQNny2XAZQPeFkdmp1XxxmEVxtnpcRiGK8YflkwU,304
|
|
122
|
-
clearskies/di/additional_config.py,sha256=
|
|
122
|
+
clearskies/di/additional_config.py,sha256=PGWV-diJyqlx7WtYr4xV2Uo5W0-f4rmwdPWJRXq6V_8,592
|
|
123
123
|
clearskies/di/additional_config_auto_import.py,sha256=m57IODPbnCAus9iDu3mDp42u4H87oPZvjAlBGoS8uRQ,111
|
|
124
|
-
clearskies/di/di.py,sha256=
|
|
125
|
-
clearskies/di/standard_dependencies.py,sha256=
|
|
124
|
+
clearskies/di/di.py,sha256=4ZbOKpchVdl7-MOoKPsU_-AlZivwYCqcY0yaOZ96D0Q,15591
|
|
125
|
+
clearskies/di/standard_dependencies.py,sha256=4cxWRjru5uKLW_1IJHKAgVu2cqc9gPcV0vZVm4HQxNg,4764
|
|
126
126
|
clearskies/di/test_module/__init__.py,sha256=7YHQF7JHP0FdI7GdEGANSZ_t1EISQYhUNm1wqOg0NKw,88
|
|
127
127
|
clearskies/di/test_module/another_module/__init__.py,sha256=8SRmHPDepLKGWTUSc1ucDF6U8mJPsNDsBDmBQCpzPWo,35
|
|
128
128
|
clearskies/di/test_module/module_class.py,sha256=I_-wnMuHfbsvti-7d2Z4bXnr6deo__uvww9nds9qrlE,46
|
|
@@ -207,7 +207,7 @@ clearskies/tests/simple_api/models/__init__.py,sha256=nUA0W6fgXw_Bxa9CudkaDkC80t
|
|
|
207
207
|
clearskies/tests/simple_api/models/status.py,sha256=PEhPbaQh5qdUNHp8O0gz91LOLENAEBtqSaHxUPXchaM,699
|
|
208
208
|
clearskies/tests/simple_api/models/user.py,sha256=5_P4Tp1tTdX7PkMJ__epPM5MA7JAeVYGas69vcWloLc,819
|
|
209
209
|
clearskies/tests/simple_api/users_api.py,sha256=KYXCgEofDxHeRdQK67txN5oYUPvxxmB8JTku7L-apk4,2344
|
|
210
|
-
clear_skies-1.22.
|
|
211
|
-
clear_skies-1.22.
|
|
212
|
-
clear_skies-1.22.
|
|
213
|
-
clear_skies-1.22.
|
|
210
|
+
clear_skies-1.22.8.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
|
|
211
|
+
clear_skies-1.22.8.dist-info/METADATA,sha256=AQzJEZCIk6vq6s6ihV9Vmgiz1m6Eq1o6NmPy-aR97-A,1817
|
|
212
|
+
clear_skies-1.22.8.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
213
|
+
clear_skies-1.22.8.dist-info/RECORD,,
|
|
@@ -120,7 +120,22 @@ class HasMany(Column):
|
|
|
120
120
|
def provide(self, data, column_name):
|
|
121
121
|
foreign_column_name = self.config("foreign_column_name")
|
|
122
122
|
id_column_name = self.config("parent_id_column_name")
|
|
123
|
-
|
|
123
|
+
children = self.child_models.where(f"{foreign_column_name}={data[id_column_name]}")
|
|
124
|
+
|
|
125
|
+
wheres = self.config("where", silent=True)
|
|
126
|
+
if not wheres:
|
|
127
|
+
return children
|
|
128
|
+
|
|
129
|
+
for index, where in enumerate(wheres):
|
|
130
|
+
if callable(where):
|
|
131
|
+
children = self.di.call_function(where, model=children, children=children, parent_data=data)
|
|
132
|
+
if not children:
|
|
133
|
+
raise ValueError(
|
|
134
|
+
f"Configuration error for column '{self.name}' in model '{self.model_class.__name__}': when 'where' is a callable, it must return a models class, but when the callable in where entry #{index+1} was called, it did not return the models class"
|
|
135
|
+
)
|
|
136
|
+
else:
|
|
137
|
+
children = children.where(where)
|
|
138
|
+
return children
|
|
124
139
|
|
|
125
140
|
def to_json(self, model):
|
|
126
141
|
children = []
|
|
@@ -142,21 +157,7 @@ class HasMany(Column):
|
|
|
142
157
|
|
|
143
158
|
@property
|
|
144
159
|
def child_models(self):
|
|
145
|
-
|
|
146
|
-
wheres = self.config("where", silent=True)
|
|
147
|
-
if not wheres:
|
|
148
|
-
return children
|
|
149
|
-
|
|
150
|
-
for index, where in enumerate(wheres):
|
|
151
|
-
if callable(where):
|
|
152
|
-
children = self.di.call_function(where, model=children)
|
|
153
|
-
if not children:
|
|
154
|
-
raise ValueError(
|
|
155
|
-
f"Configuration error for column '{self.name}' in model '{self.model_class.__name__}': when 'where' is a callable, it must return a models class, but when the callable in where entry #{index+1} was called, it did not return the models class"
|
|
156
|
-
)
|
|
157
|
-
else:
|
|
158
|
-
children = children.where(where)
|
|
159
|
-
return children
|
|
160
|
+
return self.di.build(self.config("child_models_class"), cache=True)
|
|
160
161
|
|
|
161
162
|
def documentation(self, name=None, example=None, value=None):
|
|
162
163
|
columns = self.get_child_columns()
|
clearskies/di/di.py
CHANGED
|
@@ -180,7 +180,7 @@ class DI:
|
|
|
180
180
|
if not additional_config.can_build(name):
|
|
181
181
|
continue
|
|
182
182
|
built_value = additional_config.build(name, self, context=context)
|
|
183
|
-
if cache:
|
|
183
|
+
if cache and self.call_function(additional_config.can_cache, name=name, context=context):
|
|
184
184
|
self._prepared[name] = built_value
|
|
185
185
|
return built_value
|
|
186
186
|
|
|
@@ -123,7 +123,9 @@ class StandardDependencies(DI):
|
|
|
123
123
|
return datetime.datetime.now(datetime.timezone.utc)
|
|
124
124
|
|
|
125
125
|
def provide_input_output(self):
|
|
126
|
-
raise AttributeError(
|
|
126
|
+
raise AttributeError(
|
|
127
|
+
"The dependency injector requested an InputOutput but none has been configured. Alternatively, if you directly called `di.build('input_output')` then try again with `di.build('input_output', cache=True)`"
|
|
128
|
+
)
|
|
127
129
|
|
|
128
130
|
def provide_authentication(self):
|
|
129
131
|
raise AttributeError("The dependency injector requested an Authenticaiton method but none has been configured")
|
|
File without changes
|
|
File without changes
|