clear-skies 1.18.7__py3-none-any.whl → 1.18.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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: clear-skies
3
- Version: 1.18.7
3
+ Version: 1.18.8
4
4
  Summary: A framework for building backends in the cloud
5
5
  Home-page: https://github.com/cmancone/clearskies
6
6
  License: MIT
@@ -61,7 +61,7 @@ clearskies/column_types/boolean.py,sha256=1yyM1CUfgD84pPE65c1OP1Qjf_J0Z45hjPrDR5
61
61
  clearskies/column_types/category_tree.py,sha256=PgNmzZPyqYS5NADH_QTCxLvDXZFxzv5ESKTkvPrrLXo,9140
62
62
  clearskies/column_types/column.py,sha256=TCGqtsCEYJr6BHs-PS1yFoUHGIwcx5oTujytNkTAcrk,13243
63
63
  clearskies/column_types/created.py,sha256=R8P3egUb7JEHoU_NtbmN9OIwBUHQ0XFi1GoAb5RpSkI,339
64
- clearskies/column_types/created_by_authorization_data.py,sha256=TBcALV3uchur2Aq9JCRCAihjZrZKc95VZJSIYgY3Ve0,557
64
+ clearskies/column_types/created_by_authorization_data.py,sha256=--1w1TOSo2CMwrpn6Y_iorl2RTqLgG8MbR8k27qreew,1108
65
65
  clearskies/column_types/created_by_ip.py,sha256=wwCUoEwHEVGN89x4xP7NJ6QR85Aum6v3JmxofoQrqtg,395
66
66
  clearskies/column_types/created_by_user_agent.py,sha256=sSYDRrqSjsCwcYlhF_s9NO-iDww3PaH6aO2ATp_SKGQ,419
67
67
  clearskies/column_types/datetime.py,sha256=MuVaeI6FMgevTdgv6djZjlHogs72TC1HTuYdw_6MF2M,3824
@@ -143,7 +143,7 @@ clearskies/handlers/restful_api.py,sha256=1rJ2REX1sTAdbqaRuCclP375agrho4zNNQx6hX
143
143
  clearskies/handlers/routing.py,sha256=uWKWcEaiHVqfDebPkQVuG9AS8pOixW31wW0yIQ-25Aw,3079
144
144
  clearskies/handlers/schema_helper.py,sha256=62644USvFlZu_6tT7rb-k6t_5J3Q0uZsJwP5KREk_WM,4961
145
145
  clearskies/handlers/simple_routing.py,sha256=8T4eKLIurZO3ZdIPgi-0pypQp_X4BKkbet_Ymba5br4,9332
146
- clearskies/handlers/simple_routing_route.py,sha256=C-dDLubkUnAazxAcXoyGxMX4g24Iwz7wX5rf5T8T8kU,7376
146
+ clearskies/handlers/simple_routing_route.py,sha256=bdJh1Py6FhWU8kO_9au0rkjbRUXhafPInskg2tOfnVU,8609
147
147
  clearskies/handlers/simple_search.py,sha256=hZ0rMfhS-BB6LTpdl0I53pEUBgbgIwtXvcW_8ZEOZOs,6003
148
148
  clearskies/handlers/update.py,sha256=VCZkoID7i5VHq78fkIpjbRdXQ4Z3IuXEE5dfC8z4RZI,4088
149
149
  clearskies/handlers/write.py,sha256=VduGtjnFMQOvo3l0t-tUP4PExPJ9JEpuziHsquF08rE,9344
@@ -187,7 +187,7 @@ clearskies/tests/simple_api/models/__init__.py,sha256=nUA0W6fgXw_Bxa9CudkaDkC80t
187
187
  clearskies/tests/simple_api/models/status.py,sha256=PEhPbaQh5qdUNHp8O0gz91LOLENAEBtqSaHxUPXchaM,699
188
188
  clearskies/tests/simple_api/models/user.py,sha256=5_P4Tp1tTdX7PkMJ__epPM5MA7JAeVYGas69vcWloLc,819
189
189
  clearskies/tests/simple_api/users_api.py,sha256=KYXCgEofDxHeRdQK67txN5oYUPvxxmB8JTku7L-apk4,2344
190
- clear_skies-1.18.7.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
191
- clear_skies-1.18.7.dist-info/METADATA,sha256=UhL9HJMycdJjUww9mGxmeUfsI2fPtOuYdlnw1aPuLlw,1366
192
- clear_skies-1.18.7.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
193
- clear_skies-1.18.7.dist-info/RECORD,,
190
+ clear_skies-1.18.8.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
191
+ clear_skies-1.18.8.dist-info/METADATA,sha256=C2EEmkDNduNK0DI7pww5bcCHX0oEzAkNBn4S3F3FsJQ,1366
192
+ clear_skies-1.18.8.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
193
+ clear_skies-1.18.8.dist-info/RECORD,,
@@ -18,4 +18,9 @@ class CreatedByAuthorizationData(String):
18
18
  return data
19
19
 
20
20
  authorization_data = self.di.build("input_output", cache=True).get_authorization_data()
21
- return {**data, self.name: authorization_data.get(self.config("authorization_data_key_name"), "N/A")}
21
+ # data comes last so that it can override the info in the authorization data. This seems counter-intuitive,
22
+ # but is important. You would think that you *don't* want the data from the authorization data to be
23
+ # overridden (since this is mainly used for logging), but the trouble is that there are a variety of use-cases
24
+ # where the application must provide the audit data. Examples include registration and login. In these
25
+ # cases, authorization data will be empty, and must be provided by the applicaiton.
26
+ return {self.name: authorization_data.get(self.config("authorization_data_key_name"), "N/A"), **data}
@@ -1,9 +1,13 @@
1
+ import logging
1
2
  import urllib.parse
2
3
  import re
4
+ import json
3
5
  from ..autodoc.request import URLPath
4
6
  from ..autodoc.schema import String
5
7
  from . import simple_routing
6
8
 
9
+ logger = logging.getLogger(__name__)
10
+
7
11
 
8
12
  class SimpleRoutingRoute:
9
13
  _di = None
@@ -91,26 +95,45 @@ class SimpleRoutingRoute:
91
95
  to understand if there was no route match at all.
92
96
  """
93
97
  # if we're routing to a simple router then defer to it
98
+ incoming = f"Incoming request: [{request_method}] {full_path}. Check against route with url '{self._path}' "
99
+ if not self._methods:
100
+ incoming += " configured for any method except OPTIONS"
101
+ elif isinstance(self._methods, str):
102
+ incoming += f" with method '{self._methods}'"
103
+ else:
104
+ incoming += " with any of the following methods: " + ", ".join(self._methods)
94
105
  if self._routes_to_simple_routing:
95
106
  return self._handler.can_handle(full_path, request_method, is_cors=is_cors)
96
107
  # If we're routing for CORS then ignore the request method (since it won't match)
97
108
  if not is_cors and self._methods is not None and request_method not in self._methods:
109
+ logger.debug(
110
+ f"{incoming} Skipped because this route is not specifically configured for CORS, and this is an OPTIONS request."
111
+ )
98
112
  return None
99
113
  if self._resource_paths:
100
- return self._resource_path_match(full_path, self._path_parts, self._resource_paths)
114
+ results = self._resource_path_match(full_path, self._path_parts, self._resource_paths)
115
+ if not results:
116
+ logger.debug(f"{incoming} Not a match.")
117
+ else:
118
+ logger.debug(f"{incoming} Matched and extracted route data: " + json.dumps(results))
119
+ return results
101
120
  if self._path is not None:
102
121
  full_path = full_path.strip("/")
103
122
  my_path = self._path.strip("/")
104
123
  my_path_length = len(my_path)
105
124
  full_path_length = len(full_path)
106
125
  if my_path_length > full_path_length:
126
+ logger.debug(f"{incoming} Not a match. I'm too long to bother checking.")
107
127
  return None
108
128
  if full_path[:my_path_length] != my_path:
129
+ logger.debug(f"{incoming} Not a match. Our prefixes just don't match.")
109
130
  return None
110
131
  # make sure we don't get confused by partial matches. `user` should match `user/` and `user/5`,
111
132
  # but it shouldn't match `users/`
112
133
  if full_path_length > my_path_length and full_path[my_path_length] != "/":
134
+ logger.debug(f"{incoming} Not a match. I only partially matched the URL but not as a sub-directory.")
113
135
  return None
136
+ logger.debug(f"{incoming} Match!")
114
137
  return {}
115
138
 
116
139
  def _resource_path_match(self, requested_path, path_parts, resource_paths):