kinto 20.0.0__py3-none-any.whl → 20.1.0__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 kinto might be problematic. Click here for more details.

kinto/config/kinto.tpl CHANGED
@@ -245,7 +245,7 @@ keys = root, kinto
245
245
  keys = console
246
246
 
247
247
  [formatters]
248
- keys = color
248
+ keys = color, json
249
249
 
250
250
  [logger_root]
251
251
  level = INFO
@@ -258,10 +258,13 @@ qualname = kinto
258
258
  propagate = 0
259
259
 
260
260
  [handler_console]
261
- class = StreamHandler
261
+ class = kinto.core.StreamHandlerWithRequestID
262
262
  args = (sys.stderr,)
263
263
  level = NOTSET
264
264
  formatter = color
265
265
 
266
266
  [formatter_color]
267
267
  class = logging_color_formatter.ColorFormatter
268
+
269
+ [formatter_json]
270
+ class = kinto.core.JsonLogFormatter
kinto/core/__init__.py CHANGED
@@ -151,6 +151,20 @@ class JsonLogFormatter(dockerflow_logging.JsonLogFormatter):
151
151
  self.logger_name = logger_name
152
152
 
153
153
 
154
+ class StreamHandlerWithRequestID(logging.StreamHandler):
155
+ """
156
+ A custom StreamHandler that adds the Dockerflow's `RequestIdLogFilter`.
157
+
158
+ Defining a custom handler seems to be the only way to bypass the fact that
159
+ ``logging.config.fileConfig()`` does not load filters from ``.ini`` files.
160
+ """
161
+
162
+ def __init__(self, *args, **kwargs):
163
+ super().__init__(*args, **kwargs)
164
+ filter_ = dockerflow_logging.RequestIdLogFilter()
165
+ self.addFilter(filter_)
166
+
167
+
154
168
  def get_user_info(request):
155
169
  # Default user info (shown in hello view for example).
156
170
  user_info = {"id": request.prefixed_userid, "principals": request.prefixed_principals}
@@ -4,9 +4,9 @@ import re
4
4
  import urllib.parse
5
5
  import warnings
6
6
  from datetime import datetime
7
- from secrets import token_hex
8
7
 
9
8
  from dateutil import parser as dateparser
9
+ from dockerflow.logging import get_or_generate_request_id, request_id_context
10
10
  from pyramid.events import ApplicationCreated, NewRequest, NewResponse
11
11
  from pyramid.exceptions import ConfigurationError
12
12
  from pyramid.httpexceptions import (
@@ -374,12 +374,15 @@ def setup_logging(config):
374
374
  message="Invalid URL path.",
375
375
  )
376
376
 
377
+ rid = get_or_generate_request_id(headers=request.headers)
378
+ request_id_context.set(rid)
379
+
377
380
  request.log_context(
378
381
  agent=request.headers.get("User-Agent"),
379
382
  path=request_path,
380
383
  method=request.method,
381
384
  lang=request.headers.get("Accept-Language"),
382
- rid=request.headers.get("X-Request-Id", token_hex(16)),
385
+ rid=rid,
383
386
  errno=0,
384
387
  )
385
388
  qs = dict(errors.request_GET(request))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: kinto
3
- Version: 20.0.0
3
+ Version: 20.1.0
4
4
  Summary: Kinto Web Service - Store, Sync, Share, and Self-Host.
5
5
  Author-email: Mozilla Services <developers@kinto-storage.org>
6
6
  License: Copyright 2012 - Mozilla Foundation
@@ -5,14 +5,14 @@ kinto/contribute.json,sha256=HT9QVB8rA8jWIREQoqWfMibfJXMAzbRsixW8F6O6cQY,792
5
5
  kinto/events.py,sha256=NMPvKUdbi25aYHhu9svzQsrEZMa9nyO4mtuMZC5871Q,85
6
6
  kinto/schema_validation.py,sha256=mtAmnl5HwiUsjS2gU8MKH4lkZ1380A5wZht-w9s5X7M,5306
7
7
  kinto/config/__init__.py,sha256=av8W0utmjheueFqrjTYEDk_vbpm3XYdHcqv5lppNR4k,2131
8
- kinto/config/kinto.tpl,sha256=-JOQe32J7JYpq7XxSefhaGsbnaArxliJJ4RCTI6VEsE,8117
9
- kinto/core/__init__.py,sha256=1torTd1T89nHUdsqmCJ3o85lJVakcsERIglEMu5VmkE,8171
8
+ kinto/config/kinto.tpl,sha256=Pm9p_oRsBlVoEXPVA2X6Wvv49jMOVv-27jw4rahVlwE,8201
9
+ kinto/core/__init__.py,sha256=s7PshdeKmpiqI5sW-zdC7p3Ig-e60w4kiUwlKi-impY,8655
10
10
  kinto/core/authentication.py,sha256=HLA0kREC3GMEsrIsHsQYjVNztYfAF01kb8-pLboByFs,1527
11
11
  kinto/core/authorization.py,sha256=GywY25KEzuSSAI709dFHDfdLnKxy3SLEYGwW5FkQ7Qc,13212
12
12
  kinto/core/decorators.py,sha256=3SAPWXlyPNUSICZ9mz04bcN-UdbnDuFOtU0bQHHzLis,2178
13
13
  kinto/core/errors.py,sha256=JXZjkPYjjC0I6x02d2VJRGeaQ2yZYS2zm5o7_ljfyes,8946
14
14
  kinto/core/events.py,sha256=SYpXgKMtVjiD9fwYJA2Omdom9yA3nBqi9btdvU1I_nc,10345
15
- kinto/core/initialization.py,sha256=pG-erCSlQr0fdINsim3c8G0X_T8wa7AQCHDIfObMM6E,26121
15
+ kinto/core/initialization.py,sha256=ZjmCKc8MYZXv63W2mv--fY8rXSLAnJa7RtCYdfK4jsg,26225
16
16
  kinto/core/metrics.py,sha256=Y6Mt4PUzy2-oudeGr_oCmtX8nIR4SZkzUlPxr58jr-g,2619
17
17
  kinto/core/openapi.py,sha256=92sZviff4NCxN0jMnu5lPUnF5iQbrKMGy7Cegf-VAME,3876
18
18
  kinto/core/schema.py,sha256=d5L5TQynRYJPkZ8Mu2X7F72xEh6SKDbrHK1CNTdOf2E,3646
@@ -140,9 +140,9 @@ kinto/views/contribute.py,sha256=PJoIMLj9_IszSjgZkaCd_TUjekDgNqjpmVTmRN9ztaA,983
140
140
  kinto/views/groups.py,sha256=jOq5fX0-4lwZE8k1q5HME2tU7x9052rtBPF7YqcJ-Qg,3181
141
141
  kinto/views/permissions.py,sha256=F0_eKx201WyLonXJ5vLdGKa9RcFKjvAihrEEhU1JuLw,9069
142
142
  kinto/views/records.py,sha256=lYfACW2L8qcQoyYBD5IX-fTPjFWmGp7GjHq_U4InlyE,5037
143
- kinto-20.0.0.dist-info/LICENSE,sha256=oNEIMTuTJzppR5ZEyi86yvvtSagveMYXTYFn56zF0Uk,561
144
- kinto-20.0.0.dist-info/METADATA,sha256=pKI1dh73e-geI9yxRyFWz3caWaVKYB17kcfMidCuQn8,8709
145
- kinto-20.0.0.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
146
- kinto-20.0.0.dist-info/entry_points.txt,sha256=3KlqBWPKY81mrCe_oX0I5s1cRO7Q53nCLbnVr5P9LH4,85
147
- kinto-20.0.0.dist-info/top_level.txt,sha256=EG_YmbZL6FAug9VwopG7JtF9SvH_r0DEnFp-3twPPys,6
148
- kinto-20.0.0.dist-info/RECORD,,
143
+ kinto-20.1.0.dist-info/LICENSE,sha256=oNEIMTuTJzppR5ZEyi86yvvtSagveMYXTYFn56zF0Uk,561
144
+ kinto-20.1.0.dist-info/METADATA,sha256=6jx1B53Ndm7dCgUbx_JyvpsPC8SlJQj2JwoUKSYIB5w,8709
145
+ kinto-20.1.0.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
146
+ kinto-20.1.0.dist-info/entry_points.txt,sha256=3KlqBWPKY81mrCe_oX0I5s1cRO7Q53nCLbnVr5P9LH4,85
147
+ kinto-20.1.0.dist-info/top_level.txt,sha256=EG_YmbZL6FAug9VwopG7JtF9SvH_r0DEnFp-3twPPys,6
148
+ kinto-20.1.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5