clear-skies 1.19.24__py3-none-any.whl → 1.19.26__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.19.24.dist-info → clear_skies-1.19.26.dist-info}/METADATA +1 -1
- {clear_skies-1.19.24.dist-info → clear_skies-1.19.26.dist-info}/RECORD +10 -8
- clearskies/handlers/callable.py +4 -2
- clearskies/handlers/simple_routing.py +2 -0
- clearskies/input_requirements/__init__.py +10 -0
- clearskies/input_requirements/maximum_value.py +19 -0
- clearskies/input_requirements/minimum_value.py +19 -0
- clearskies/model.py +10 -2
- {clear_skies-1.19.24.dist-info → clear_skies-1.19.26.dist-info}/LICENSE +0 -0
- {clear_skies-1.19.24.dist-info → clear_skies-1.19.26.dist-info}/WHEEL +0 -0
|
@@ -128,7 +128,7 @@ clearskies/functional/validations.py,sha256=f1fTQ4rdFZouxoovAPg-YAgf0Q0QNpKEzxWW
|
|
|
128
128
|
clearskies/handlers/__init__.py,sha256=9tH0zk4g7Mt22opD1NlynqXwwMX2DHzLmAVihZsJsfU,1011
|
|
129
129
|
clearskies/handlers/advanced_search.py,sha256=UbWDntGAGD5NM61yKEws5MfG0Xy3K_fn-i-X9FG-mKs,13746
|
|
130
130
|
clearskies/handlers/base.py,sha256=aFRm5R6oDJWO4TTxz9BusxuDF3aH_-QVGJUP9atNzLc,22787
|
|
131
|
-
clearskies/handlers/callable.py,sha256=
|
|
131
|
+
clearskies/handlers/callable.py,sha256=SLgCln-6jvZJjmBOlxrnRXamICM_Wj3zY5Uah4_Wutg,8269
|
|
132
132
|
clearskies/handlers/create.py,sha256=xj_hVYma2sKDK5Vq_R9wo8f0ZXfGlXTkYU71AMyKF2U,1232
|
|
133
133
|
clearskies/handlers/crud_by_method.py,sha256=BOkPX-LUvQrbRLSbyTfRh4c8nPF51dZEXSKOl7m9ZYA,435
|
|
134
134
|
clearskies/handlers/database_connector.py,sha256=XLF_Y3aYnjDtOVP_MOtT5mbI3lHR8S-viOxPiqEAamE,1050
|
|
@@ -148,7 +148,7 @@ clearskies/handlers/request_method_routing.py,sha256=DgPEz3tgbaUkXHsOriPbIctfSf4
|
|
|
148
148
|
clearskies/handlers/restful_api.py,sha256=1rJ2REX1sTAdbqaRuCclP375agrho4zNNQx6hXGa4nQ,9258
|
|
149
149
|
clearskies/handlers/routing.py,sha256=uWKWcEaiHVqfDebPkQVuG9AS8pOixW31wW0yIQ-25Aw,3079
|
|
150
150
|
clearskies/handlers/schema_helper.py,sha256=62644USvFlZu_6tT7rb-k6t_5J3Q0uZsJwP5KREk_WM,4961
|
|
151
|
-
clearskies/handlers/simple_routing.py,sha256=
|
|
151
|
+
clearskies/handlers/simple_routing.py,sha256=xMVfBas51pZOP8xvDmeH6L-iO6CGIrICyT5yUYceJOs,9550
|
|
152
152
|
clearskies/handlers/simple_routing_route.py,sha256=3U3dixEKuf-Xo88RQGH_grm1x79-px6idt1-xaLUSiY,8953
|
|
153
153
|
clearskies/handlers/simple_search.py,sha256=bSfq8rzdqkBj-dTGUBSZ1EkfjzUWHID7mKD2xEf8VzQ,6165
|
|
154
154
|
clearskies/handlers/update.py,sha256=rx8HW87Pfh95e_9nEfKKnxfkh2HBlCUdYqVwljtXiJ8,4116
|
|
@@ -160,7 +160,7 @@ clearskies/input_outputs/exceptions/cli_input_error.py,sha256=kOFU8aLTLmeTL_AKDs
|
|
|
160
160
|
clearskies/input_outputs/exceptions/cli_not_found.py,sha256=JBBuZA9ZwdkPhd3a0qaGgEPQrxh1fehy4R3ZaV2gWXU,39
|
|
161
161
|
clearskies/input_outputs/input_output.py,sha256=vYKn9SE5erS4LuOhhAsXqaOEsGXwZ1NJ4v85KN1Xg6A,4501
|
|
162
162
|
clearskies/input_outputs/wsgi.py,sha256=9p82eJP5FUAI6jbIojvydG3_9gncX7vcUACQMyRN9x4,3142
|
|
163
|
-
clearskies/input_requirements/__init__.py,sha256=
|
|
163
|
+
clearskies/input_requirements/__init__.py,sha256=cciSC614VlYsCeTBX69ZCBU6QByT8NNlzWu_n2SVieY,2106
|
|
164
164
|
clearskies/input_requirements/after.py,sha256=TXy8bIVz_77a8oJuohPwoM5E--AOVWsOSjjh5PpA2Ys,1544
|
|
165
165
|
clearskies/input_requirements/before.py,sha256=iLg-Hub9iW2eP19s5fkPrA9TCT_-DTm5KoxgA8ho0-k,1547
|
|
166
166
|
clearskies/input_requirements/in_the_future_at_least.py,sha256=PLVp_2Yv-1ScKnajlc9hjG7qYZhadKXHNTkRP7WKUdo,739
|
|
@@ -168,7 +168,9 @@ clearskies/input_requirements/in_the_future_at_most.py,sha256=L5Oz47KAHv5WL6Nu2v
|
|
|
168
168
|
clearskies/input_requirements/in_the_past_at_least.py,sha256=ES0SgtADHcu7HZDdvIFyD9vpYTnrd4hBi03OShqUZg4,735
|
|
169
169
|
clearskies/input_requirements/in_the_past_at_most.py,sha256=hvhn_K1X4f7pbpFhjavR6Mu48JhhYcEIUx44YWfa_7E,733
|
|
170
170
|
clearskies/input_requirements/maximum_length.py,sha256=7hdGVq914BtZQwiGOLOU-t5QTDNQtCPT4TOnYTUo3Wo,689
|
|
171
|
+
clearskies/input_requirements/maximum_value.py,sha256=R9xyup70a3migJdUKmflpZnQMHShcCqyibOewh78D84,663
|
|
171
172
|
clearskies/input_requirements/minimum_length.py,sha256=qSpLjNBu6AKRoBZi3jvCMYKsHwsknbkUk86C8CMIOEU,987
|
|
173
|
+
clearskies/input_requirements/minimum_value.py,sha256=PNZShiy_cFjwoRejjZmN_INp7EtmzmX1RQp3JfyYBMg,664
|
|
172
174
|
clearskies/input_requirements/required.py,sha256=luYP527YPkQIVNVPhnNztOI0UxO67gNqn3FiLBId1YE,1133
|
|
173
175
|
clearskies/input_requirements/requirement.py,sha256=5wUywAvbEQPh9tpfwWX3gdi4dwI-Xs9ePyC30qvwPaQ,584
|
|
174
176
|
clearskies/input_requirements/time_delta.py,sha256=lqajxGEp2zZB_Rk-dG8eWgpljbuph1yqZMuylYRYJKs,1247
|
|
@@ -176,7 +178,7 @@ clearskies/input_requirements/unique.py,sha256=gpbm9uoXcy8WCHsuWqAotwockbjDfJOWi
|
|
|
176
178
|
clearskies/mocks/__init__.py,sha256=T68OUB9gGCX0WoisGzsY3Bt2cCFX7ILHKPqi6XKTJM0,113
|
|
177
179
|
clearskies/mocks/input_output.py,sha256=2wD5GbUyVSkXcBg1GTZ-Oz9VzcYxNHfTlmZAODW-7CI,3898
|
|
178
180
|
clearskies/mocks/models.py,sha256=DCzsnMddBvPoBA8JwwbSOhzY7enQWrosgeYD4gx2deI,5124
|
|
179
|
-
clearskies/model.py,sha256=
|
|
181
|
+
clearskies/model.py,sha256=6H6eGQqMBz22bWu20N4xy7XPa1qYgfvNWik5cXH2DZg,13137
|
|
180
182
|
clearskies/models.py,sha256=lKZM2WXIPcziApee_4Iwabcd5xb4gexxKN71PTiQuOY,12332
|
|
181
183
|
clearskies/secrets/__init__.py,sha256=ctTmA_etV9G_5U21APWENI1HvThrBS4DidGWRtEDHQs,1053
|
|
182
184
|
clearskies/secrets/additional_configs/__init__.py,sha256=cFCrbtKF5nuR061S2y1iKZp349x-y8Srdwe3VZbfSFU,1119
|
|
@@ -200,7 +202,7 @@ clearskies/tests/simple_api/models/__init__.py,sha256=nUA0W6fgXw_Bxa9CudkaDkC80t
|
|
|
200
202
|
clearskies/tests/simple_api/models/status.py,sha256=PEhPbaQh5qdUNHp8O0gz91LOLENAEBtqSaHxUPXchaM,699
|
|
201
203
|
clearskies/tests/simple_api/models/user.py,sha256=5_P4Tp1tTdX7PkMJ__epPM5MA7JAeVYGas69vcWloLc,819
|
|
202
204
|
clearskies/tests/simple_api/users_api.py,sha256=KYXCgEofDxHeRdQK67txN5oYUPvxxmB8JTku7L-apk4,2344
|
|
203
|
-
clear_skies-1.19.
|
|
204
|
-
clear_skies-1.19.
|
|
205
|
-
clear_skies-1.19.
|
|
206
|
-
clear_skies-1.19.
|
|
205
|
+
clear_skies-1.19.26.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
|
|
206
|
+
clear_skies-1.19.26.dist-info/METADATA,sha256=7D3m8KlUwjEfQoW2lEAaKTUgJW2-wlLkS_Qd0pCJ3qQ,1712
|
|
207
|
+
clear_skies-1.19.26.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
208
|
+
clear_skies-1.19.26.dist-info/RECORD,,
|
clearskies/handlers/callable.py
CHANGED
|
@@ -47,16 +47,18 @@ class Callable(Base, SchemaHelper):
|
|
|
47
47
|
return self.input_errors(input_output, input_errors)
|
|
48
48
|
response = self._di.call_function(
|
|
49
49
|
self.configuration("callable"),
|
|
50
|
-
request_data=request_data,
|
|
51
50
|
**input_output.routing_data(),
|
|
52
51
|
**input_output.context_specifics(),
|
|
52
|
+
request_data=request_data,
|
|
53
|
+
authorization_data=input_output.get_authorization_data(),
|
|
53
54
|
)
|
|
54
55
|
else:
|
|
55
56
|
response = self._di.call_function(
|
|
56
57
|
self.configuration("callable"),
|
|
57
|
-
request_data=self.request_data(input_output, required=False),
|
|
58
58
|
**input_output.routing_data(),
|
|
59
59
|
**input_output.context_specifics(),
|
|
60
|
+
request_data=self.request_data(input_output, required=False),
|
|
61
|
+
authorization_data=input_output.get_authorization_data(),
|
|
60
62
|
)
|
|
61
63
|
if response:
|
|
62
64
|
return self.success(input_output, response)
|
|
@@ -157,6 +157,8 @@ class SimpleRouting(Base):
|
|
|
157
157
|
"Each route must specify the handler configuration via 'handler_config' key, "
|
|
158
158
|
+ f"but 'handler_config' was missing for route #{i+1}"
|
|
159
159
|
)
|
|
160
|
+
if route_config.get("authentication"):
|
|
161
|
+
authentication = self._di.build(route_config.get("authentication"), cache=True)
|
|
160
162
|
route = SimpleRoutingRoute(self._di)
|
|
161
163
|
route.configure(
|
|
162
164
|
route_config["handler_class"],
|
|
@@ -4,7 +4,9 @@ from .after import After
|
|
|
4
4
|
from .before import Before
|
|
5
5
|
from ..binding_config import BindingConfig
|
|
6
6
|
from .minimum_length import MinimumLength
|
|
7
|
+
from .minimum_value import MinimumValue
|
|
7
8
|
from .maximum_length import MaximumLength
|
|
9
|
+
from .maximum_value import MaximumValue
|
|
8
10
|
from .required import Required
|
|
9
11
|
from .requirement import Requirement
|
|
10
12
|
from .unique import Unique
|
|
@@ -27,10 +29,18 @@ def minimum_length(minimum_length: int):
|
|
|
27
29
|
return BindingConfig(MinimumLength, minimum_length)
|
|
28
30
|
|
|
29
31
|
|
|
32
|
+
def minimum_value(minimum_value: int):
|
|
33
|
+
return BindingConfig(MinimumValue, minimum_value)
|
|
34
|
+
|
|
35
|
+
|
|
30
36
|
def maximum_length(maximum_length: int):
|
|
31
37
|
return BindingConfig(MaximumLength, maximum_length)
|
|
32
38
|
|
|
33
39
|
|
|
40
|
+
def maximum_value(maximum_value: int):
|
|
41
|
+
return BindingConfig(MaximumValue, maximum_value)
|
|
42
|
+
|
|
43
|
+
|
|
34
44
|
def required():
|
|
35
45
|
return BindingConfig(Required)
|
|
36
46
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .requirement import Requirement
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class MaximumValue(Requirement):
|
|
5
|
+
maximum_value = None
|
|
6
|
+
|
|
7
|
+
def configure(self, maximum_value):
|
|
8
|
+
if type(maximum_value) != int:
|
|
9
|
+
raise ValueError(
|
|
10
|
+
f"Maximum value must be an int to use the MaximumValue class for column '{self.column_name}'"
|
|
11
|
+
)
|
|
12
|
+
self.maximum_value = maximum_value
|
|
13
|
+
|
|
14
|
+
def check(self, model, data):
|
|
15
|
+
if self.column_name not in data or not data[self.column_name]:
|
|
16
|
+
return ""
|
|
17
|
+
if int(data[self.column_name]) <= self.maximum_value:
|
|
18
|
+
return ""
|
|
19
|
+
return f"'{self.column_name}' must be at most {self.maximum_value}."
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .requirement import Requirement
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class MinimumValue(Requirement):
|
|
5
|
+
minimum_value = None
|
|
6
|
+
|
|
7
|
+
def configure(self, minimum_value):
|
|
8
|
+
if type(minimum_value) != int:
|
|
9
|
+
raise ValueError(
|
|
10
|
+
f"Minimum value must be an int to use the MinimumValue class for column '{self.column_name}'"
|
|
11
|
+
)
|
|
12
|
+
self.minimum_value = minimum_value
|
|
13
|
+
|
|
14
|
+
def check(self, model, data):
|
|
15
|
+
if self.column_name not in data or not data[self.column_name]:
|
|
16
|
+
return ""
|
|
17
|
+
if int(data[self.column_name]) >= self.minimum_value:
|
|
18
|
+
return ""
|
|
19
|
+
return f"'{self.column_name}' must be at least {self.minimum_value}."
|
clearskies/model.py
CHANGED
|
@@ -141,7 +141,7 @@ class Model(Models):
|
|
|
141
141
|
if data is None:
|
|
142
142
|
raise ValueError("pre_save forgot to return the data array!")
|
|
143
143
|
|
|
144
|
-
to_save = self.columns_to_backend(data, save_columns)
|
|
144
|
+
[to_save, temporary_data] = self.columns_to_backend(data, save_columns)
|
|
145
145
|
to_save = self.to_backend(to_save, save_columns)
|
|
146
146
|
if self.exists:
|
|
147
147
|
new_data = self._backend.update(self._data[self.id_column_name], to_save, self)
|
|
@@ -149,6 +149,12 @@ class Model(Models):
|
|
|
149
149
|
new_data = self._backend.create(to_save, self)
|
|
150
150
|
id = self._backend.column_from_backend(save_columns[self.id_column_name], new_data[self.id_column_name])
|
|
151
151
|
|
|
152
|
+
# if we had any temporary columns add them back in
|
|
153
|
+
new_data = {
|
|
154
|
+
**temporary_data,
|
|
155
|
+
**new_data,
|
|
156
|
+
}
|
|
157
|
+
|
|
152
158
|
data = self.columns_post_save(data, id, save_columns)
|
|
153
159
|
self.post_save(data, id)
|
|
154
160
|
|
|
@@ -254,8 +260,10 @@ class Model(Models):
|
|
|
254
260
|
|
|
255
261
|
def columns_to_backend(self, data, columns):
|
|
256
262
|
backend_data = {**data}
|
|
263
|
+
temporary_data = {}
|
|
257
264
|
for column in columns.values():
|
|
258
265
|
if column.is_temporary and column.name in backend_data:
|
|
266
|
+
temporary_data[column.name] = backend_data[column.name]
|
|
259
267
|
del backend_data[column.name]
|
|
260
268
|
continue
|
|
261
269
|
|
|
@@ -265,7 +273,7 @@ class Model(Models):
|
|
|
265
273
|
f"Column {column.name} of type {column.__class__.__name__} did not return any data for to_database"
|
|
266
274
|
)
|
|
267
275
|
|
|
268
|
-
return backend_data
|
|
276
|
+
return [backend_data, temporary_data]
|
|
269
277
|
|
|
270
278
|
def to_backend(self, data, columns):
|
|
271
279
|
return data
|
|
File without changes
|
|
File without changes
|