keepup-admin 0.7.0__tar.gz → 0.7.2__tar.gz

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.
Files changed (49) hide show
  1. {keepup_admin-0.7.0/keepup_admin.egg-info → keepup_admin-0.7.2}/PKG-INFO +1 -1
  2. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/builtin/users.py +1 -1
  3. {keepup_admin-0.7.0 → keepup_admin-0.7.2/keepup_admin.egg-info}/PKG-INFO +1 -1
  4. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/observability.py +24 -1
  5. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/pyproject.toml +1 -1
  6. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/LICENSE +0 -0
  7. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/NOTICE +0 -0
  8. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/README.md +0 -0
  9. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/THIRD-PARTY.md +0 -0
  10. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/__init__.py +0 -0
  11. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/api_versions.py +0 -0
  12. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/builtin/audit.py +0 -0
  13. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/builtin/auth.py +0 -0
  14. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/builtin/db.py +0 -0
  15. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/builtin/postgres.py +0 -0
  16. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/builtin/sqlite.py +0 -0
  17. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/builtin/ui.py +0 -0
  18. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/cache.py +0 -0
  19. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/clock.py +0 -0
  20. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/instance.py +0 -0
  21. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/keepup_admin.egg-info/SOURCES.txt +0 -0
  22. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/keepup_admin.egg-info/dependency_links.txt +0 -0
  23. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/keepup_admin.egg-info/requires.txt +0 -0
  24. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/keepup_admin.egg-info/top_level.txt +0 -0
  25. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/__init__.py +0 -0
  26. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/call.py +0 -0
  27. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/catalogue.py +0 -0
  28. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/contributions.py +0 -0
  29. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/datasource.py +0 -0
  30. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/descriptor.py +0 -0
  31. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/lifecycle.py +0 -0
  32. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/loader.py +0 -0
  33. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/security.py +0 -0
  34. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/services.py +0 -0
  35. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/kernel/transports.py +0 -0
  36. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/locks.py +0 -0
  37. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/logging_setup.py +0 -0
  38. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/notification_bus.py +0 -0
  39. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/plugins/__init__.py +0 -0
  40. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/plugins/base.py +0 -0
  41. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/plugins/builtin.json +0 -0
  42. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/plugins/enablement.py +0 -0
  43. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/plugins/registry.py +0 -0
  44. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/plugins/route_mask.py +0 -0
  45. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/roles.py +0 -0
  46. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/sections.json +0 -0
  47. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/security.py +0 -0
  48. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/settings.py +0 -0
  49. {keepup_admin-0.7.0 → keepup_admin-0.7.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keepup-admin
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: An admin framework over FastAPI: plugins, panel, users, replicas
5
5
  Author-email: Fedor Sergeev <fksergeev@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -121,7 +121,7 @@ class UsersPlugin(BasePlugin):
121
121
  "description": "Accounts, the roles they hold and the rights granted",
122
122
  "js": "/keepup-static/modules/js/users.js",
123
123
  "css": "/keepup-static/modules/css/users.css",
124
- "initFunction": "initUsers",
124
+ "initFunction": "renderUsers",
125
125
  "icon": "people",
126
126
  "version": "1.0.0",
127
127
  }]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keepup-admin
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: An admin framework over FastAPI: plugins, panel, users, replicas
5
5
  Author-email: Fedor Sergeev <fksergeev@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -14,6 +14,8 @@ is set at start-up, and a deployment that sets nothing records nothing --
14
14
  which is a deployment, not a failure.
15
15
  """
16
16
 
17
+ import asyncio
18
+ import inspect
17
19
  from contextlib import asynccontextmanager
18
20
  from dataclasses import dataclass, field
19
21
  from functools import wraps
@@ -133,6 +135,27 @@ async def emit(event_type: str, payload: Mapping[str, Any] = None) -> int:
133
135
  return written
134
136
 
135
137
 
138
+ async def _run_route(handler, *args, **kwargs):
139
+ """Run a route the way the transport would, and hand back its answer.
140
+
141
+ A route is declared either with `async def` or with `def`, and the second is
142
+ a decision rather than an oversight: FastAPI runs a `def` route in a worker
143
+ thread, which is where a database call or a `bcrypt` hash belongs. The audit
144
+ wrapper around it is a coroutine either way, so awaiting a plain function was
145
+ a `TypeError` -- `object dict can't be used in 'await' expression` -- thrown
146
+ *after* the handler had already done its work: (0.7.0) the administrator's
147
+ password change and the profile update applied their change and answered 500
148
+ (keepup-182).
149
+
150
+ A synchronous handler therefore goes to a thread of its own, not to the event
151
+ loop; `asyncio.to_thread` copies the context, so the audit's request id and
152
+ actor are the ones the handler sees.
153
+ """
154
+ if inspect.iscoroutinefunction(handler):
155
+ return await handler(*args, **kwargs)
156
+ return await asyncio.to_thread(handler, *args, **kwargs)
157
+
158
+
136
159
  def audited(action: str, method: str = "POST", actor: str = "current_user",
137
160
  host: str = "framework"):
138
161
  """Record a framework route that the transport did not wrap (keepup-172).
@@ -160,7 +183,7 @@ def audited(action: str, method: str = "POST", actor: str = "current_user",
160
183
  caller = kwargs.get(actor)
161
184
  async with start_call(method, action, host, {}, actor=caller) as request_id:
162
185
  try:
163
- answer = await handler(*args, **kwargs)
186
+ answer = await _run_route(handler, *args, **kwargs)
164
187
  except Exception as error:
165
188
  await end_call(
166
189
  request_id,
@@ -17,7 +17,7 @@ build-backend = "setuptools.build_meta"
17
17
 
18
18
  [project]
19
19
  name = "keepup-admin"
20
- version = "0.7.0"
20
+ version = "0.7.2"
21
21
  description = "An admin framework over FastAPI: plugins, panel, users, replicas"
22
22
  readme = "README.md"
23
23
  requires-python = ">=3.11"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes