clear-skies 1.16.8__py3-none-any.whl → 1.16.10__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: clear-skies
3
- Version: 1.16.8
3
+ Version: 1.16.10
4
4
  Summary: A framework for building backends in the cloud
5
5
  Home-page: https://github.com/cmancone/clearskies
6
6
  License: MIT
@@ -129,19 +129,19 @@ clearskies/handlers/exceptions/authorization.py,sha256=14JuU5zLEf2sv82VNxsJt7dGS
129
129
  clearskies/handlers/exceptions/client_error.py,sha256=o1OGnjlXT5zZ1Vb2LTRPYIio0YAnXPpXDGuqSLQP9_Y,39
130
130
  clearskies/handlers/exceptions/input_error.py,sha256=kmEVv9LNIalLKD9GF-olsD39Z94abHGkB54NskOG6g4,136
131
131
  clearskies/handlers/exceptions/not_found.py,sha256=xThOXiMfyYBaI2bhfOhpVoZ_vdw1hU8A_HxHenPqHzo,96
132
- clearskies/handlers/get.py,sha256=iHwI4qCdxQpqHTUH7HGaFhl5fHaT5qGe7hi6OvRrBrU,6544
132
+ clearskies/handlers/get.py,sha256=_5aPwwgSTWKIPk1E5C6fr1hq0WJz0yrNl4Dtnt4e4sk,6629
133
133
  clearskies/handlers/health_check.py,sha256=m6H3psUql-I7hZao3fsxjrZnCjFJZ1ROTF-41g8Syww,2078
134
134
  clearskies/handlers/input_processing.py,sha256=3CurzTyOsOqfmBZPWm5Sa5UjH7Bl7PkxP6obRieigGs,3250
135
135
  clearskies/handlers/list.py,sha256=bA1NG799Ru5QKoGzpsKZIjb5YwD5ZyJUv1rJL3uU-PA,22942
136
136
  clearskies/handlers/mygrations.py,sha256=4iKpJKooqgNtAURwMl_FgsXUt8OYOaG_TY1OV1llQxY,2759
137
137
  clearskies/handlers/request_method_routing.py,sha256=DgPEz3tgbaUkXHsOriPbIctfSf4Gm4NxfRdVulH91Kg,1636
138
- clearskies/handlers/restful_api.py,sha256=cD5zY-3XGhSMRlBercodxg7JHypCvfsK_ynCrbEblTU,8287
138
+ clearskies/handlers/restful_api.py,sha256=-AJRf134VJUba1Wb7yGG4Y0Hvi5UJwmiDzLbglcxGg8,8624
139
139
  clearskies/handlers/routing.py,sha256=tHJHNbszas2txUZiKl0xi2kB2x3Sjx6H8lLouoAWp4Y,3078
140
140
  clearskies/handlers/schema_helper.py,sha256=62644USvFlZu_6tT7rb-k6t_5J3Q0uZsJwP5KREk_WM,4961
141
141
  clearskies/handlers/simple_routing.py,sha256=8T4eKLIurZO3ZdIPgi-0pypQp_X4BKkbet_Ymba5br4,9332
142
- clearskies/handlers/simple_routing_route.py,sha256=QyBwZoC74fFpNPgdUT5pexwBOnFv2aQq0vEVXDDUEWc,7312
142
+ clearskies/handlers/simple_routing_route.py,sha256=0WPKrneXjbI98UOsDaZgf-OUvEd4D6gG-oIiMiiCp-k,7312
143
143
  clearskies/handlers/simple_search.py,sha256=19dOZyPXx_PMrlUCe-hoY8y3h9BNfAjAkVoxsjUl7gw,3965
144
- clearskies/handlers/update.py,sha256=cnWd2uOm2NgmLDc4Rvcujq9r9P6U2gH_vF-aaxPVEGQ,3376
144
+ clearskies/handlers/update.py,sha256=sU91QLvtQL8qfLQZWHep6oAChxvZ6EIP-YQfEPNxtG0,3585
145
145
  clearskies/handlers/write.py,sha256=VduGtjnFMQOvo3l0t-tUP4PExPJ9JEpuziHsquF08rE,9344
146
146
  clearskies/input_outputs/__init__.py,sha256=mQWL-u41FRTrPGuHe8FhLmcHjAEaUxjFwUf7RgDcbAs,182
147
147
  clearskies/input_outputs/cli.py,sha256=AOCXpjjFM7F9PJiW_UOI8fTU0gswO0Lul5xSo7ujRPs,6203
@@ -183,7 +183,7 @@ clearskies/tests/simple_api/models/__init__.py,sha256=nUA0W6fgXw_Bxa9CudkaDkC80t
183
183
  clearskies/tests/simple_api/models/status.py,sha256=PEhPbaQh5qdUNHp8O0gz91LOLENAEBtqSaHxUPXchaM,699
184
184
  clearskies/tests/simple_api/models/user.py,sha256=5_P4Tp1tTdX7PkMJ__epPM5MA7JAeVYGas69vcWloLc,819
185
185
  clearskies/tests/simple_api/users_api.py,sha256=KYXCgEofDxHeRdQK67txN5oYUPvxxmB8JTku7L-apk4,2344
186
- clear_skies-1.16.8.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
187
- clear_skies-1.16.8.dist-info/METADATA,sha256=WWm9zstPQ0X-BV1JP4P1Yn424ST_i8C_ACoeQiHEJl8,1366
188
- clear_skies-1.16.8.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
189
- clear_skies-1.16.8.dist-info/RECORD,,
186
+ clear_skies-1.16.10.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
187
+ clear_skies-1.16.10.dist-info/METADATA,sha256=Q-PsjMRYiUkWRc-WQ9bs24RQkyJu3bDydWFxSBB9Iqw,1367
188
+ clear_skies-1.16.10.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
189
+ clear_skies-1.16.10.dist-info/RECORD,,
@@ -27,9 +27,12 @@ class Get(Base):
27
27
 
28
28
  def fetch_model(self, input_output):
29
29
  routing_data = input_output.routing_data()
30
- if self.id_column_name not in routing_data:
30
+ if self.id_column_name in routing_data:
31
+ id = routing_data[self.id_column_name]
32
+ elif "id" in routing_data:
33
+ id = routing_data["id"]
34
+ else:
31
35
  raise ValueError("I didn't receive the ID in my routing data. I am probably misconfigured.")
32
- id = routing_data[self.id_column_name]
33
36
  models = self._model.where(f"{self.id_column_name}={id}")
34
37
  for where in self.configuration("where"):
35
38
  if type(where) == str:
@@ -125,6 +125,12 @@ class RestfulAPI(Routing):
125
125
  self._cached_handlers[cache_key] = self.build_handler(handler_class)
126
126
  return self._cached_handlers[cache_key]
127
127
 
128
+ def build_handler(self, handler_class, configuration=None):
129
+ if not configuration and handler_class == self.configuration("update_handler"):
130
+ configuration = self._configuration
131
+ configuration["include_id_in_path"] = True
132
+ return super().build_handler(handler_class, configuration=configuration)
133
+
128
134
  def _get_handler_class_for_route(self, input_output):
129
135
  try:
130
136
  [is_search, resource_id] = self._parse_url(input_output)
@@ -124,7 +124,7 @@ class SimpleRoutingRoute:
124
124
  return None
125
125
  for index in range(path_length):
126
126
  if index in resource_paths:
127
- if resource_paths[index] == self._path_parameter_with_slashes:
127
+ if resource_paths[index] in self._path_parameter_with_slashes:
128
128
  route_data[resource_paths[index]] = "/".join(requested_parts[index:])
129
129
  else:
130
130
  route_data[resource_paths[index]] = requested_parts[index]
@@ -16,14 +16,18 @@ class Update(Write):
16
16
  "readable_columns": None,
17
17
  "where": [],
18
18
  "input_error_callable": None,
19
+ "include_id_in_path": False,
19
20
  }
20
21
 
21
22
  def handle(self, input_output):
22
23
  input_data = self.request_data(input_output)
23
- external_id_column_name = self.auto_case_internal_column_name("id")
24
- if "id" not in input_data:
25
- return self.error(input_output, f"Missing '{external_id_column_name}' in request body", 404)
26
- model_id = input_data["id"]
24
+ routing_data = input_output.routing_data()
25
+ if self.id_column_name in routing_data:
26
+ model_id = routing_data[self.id_column_name]
27
+ elif "id" in routing_data:
28
+ model_id = routing_data["id"]
29
+ else:
30
+ raise ValueError("I didn't receive the ID in my routing data. I am probably misconfigured.")
27
31
  id_column_name = self.id_column_name
28
32
  models = self._model.where(f"{id_column_name}={model_id}")
29
33
  for where in self.configuration("where"):
@@ -39,7 +43,8 @@ class Update(Write):
39
43
  model = models.first()
40
44
  if not model.exists:
41
45
  return self.error(input_output, "Not Found", 404)
42
- del input_data["id"]
46
+ if "id" in input_data:
47
+ del input_data["id"]
43
48
 
44
49
  input_errors = {
45
50
  **self._extra_column_errors(input_data),
@@ -74,5 +79,5 @@ class Update(Write):
74
79
  return self._documentation(
75
80
  description="Update the " + nice_model + " with an " + id_label + " of {" + id_label + "}",
76
81
  response_description=f"The updated {nice_model}",
77
- include_id_in_path=True,
82
+ include_id_in_path=self.configuration("include_id_in_path"),
78
83
  )