tina4-python 3.13.150__tar.gz → 3.13.151__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 (203) hide show
  1. {tina4_python-3.13.150 → tina4_python-3.13.151}/PKG-INFO +5 -7
  2. {tina4_python-3.13.150 → tina4_python-3.13.151}/README.md +1 -1
  3. {tina4_python-3.13.150 → tina4_python-3.13.151}/pyproject.toml +16 -19
  4. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/CLAUDE.md +2 -1
  5. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/__init__.py +1 -1
  6. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/cache/__init__.py +9 -1
  7. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/middleware.py +15 -0
  8. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/request.py +190 -11
  9. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/server.py +37 -2
  10. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/crud/page.py +1 -1
  11. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/crud/page_render.py +5 -5
  12. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/dev_admin/metrics.py +5 -1
  13. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/frond/engine.py +174 -11
  14. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/realtime/__init__.py +15 -4
  15. tina4_python-3.13.151/tina4_python/realtime/s3_client.py +255 -0
  16. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/realtime/storage.py +18 -27
  17. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/crud/form.twig +5 -5
  18. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/crud/table.twig +2 -2
  19. tina4_python-3.13.151/tina4_python/templates/errors/302.twig +23 -0
  20. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/websocket/__init__.py +6 -3
  21. tina4_python-3.13.150/tina4_python/templates/errors/302.twig +0 -22
  22. {tina4_python-3.13.150 → tina4_python-3.13.151}/.gitignore +0 -0
  23. {tina4_python-3.13.150 → tina4_python-3.13.151}/COMMERCIAL-LICENSE.md +0 -0
  24. {tina4_python-3.13.150 → tina4_python-3.13.151}/LICENSE +0 -0
  25. {tina4_python-3.13.150 → tina4_python-3.13.151}/NOTICE +0 -0
  26. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/.tina4-metrics.json +0 -0
  27. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/HtmlElement.py +0 -0
  28. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/Testing.py +0 -0
  29. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/_import_helper.py +0 -0
  30. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/ai/__init__.py +0 -0
  31. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/ai/client.py +0 -0
  32. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/api/__init__.py +0 -0
  33. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/auth/__init__.py +0 -0
  34. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/cli/__init__.py +0 -0
  35. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/container/__init__.py +0 -0
  36. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/context/__init__.py +0 -0
  37. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/context/chunker.py +0 -0
  38. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/__init__.py +0 -0
  39. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/cache.py +0 -0
  40. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/constants.py +0 -0
  41. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/csp.py +0 -0
  42. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/events.py +0 -0
  43. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/port_takeover.py +0 -0
  44. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/rate_limiter.py +0 -0
  45. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/response.py +0 -0
  46. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/core/router.py +0 -0
  47. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/crud/__init__.py +0 -0
  48. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/__init__.py +0 -0
  49. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/adapter.py +0 -0
  50. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/async_api.py +0 -0
  51. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/connection.py +0 -0
  52. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/database_url.py +0 -0
  53. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/firebird.py +0 -0
  54. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/mongodb.py +0 -0
  55. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/mssql.py +0 -0
  56. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/mysql.py +0 -0
  57. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/odbc.py +0 -0
  58. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/pool.py +0 -0
  59. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/postgres.py +0 -0
  60. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/sql_translator.py +0 -0
  61. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/database/sqlite.py +0 -0
  62. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/debug/__init__.py +0 -0
  63. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/debug/error_overlay.py +0 -0
  64. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/dev_admin/__init__.py +0 -0
  65. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/dev_admin/plan.py +0 -0
  66. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/dev_admin/project_index.py +0 -0
  67. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/docs.py +0 -0
  68. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/docstore/__init__.py +0 -0
  69. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/dotenv/__init__.py +0 -0
  70. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/env.py +0 -0
  71. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/frond/FROND.md +0 -0
  72. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/frond/__init__.py +0 -0
  73. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/frond/compiler.py +0 -0
  74. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/frond/parser.py +0 -0
  75. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/auth/meta.json +0 -0
  76. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/auth/src/routes/api/gallery_auth.py +0 -0
  77. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/database/meta.json +0 -0
  78. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/database/src/routes/api/gallery_db.py +0 -0
  79. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/error-overlay/meta.json +0 -0
  80. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/error-overlay/src/routes/api/gallery_crash.py +0 -0
  81. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/orm/meta.json +0 -0
  82. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/orm/src/orm/Product.py +0 -0
  83. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/orm/src/routes/api/gallery_products.py +0 -0
  84. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/queue/meta.json +0 -0
  85. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/queue/src/routes/api/gallery_queue.py +0 -0
  86. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/rest-api/meta.json +0 -0
  87. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/rest-api/src/routes/api/gallery_hello.py +0 -0
  88. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/templates/meta.json +0 -0
  89. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/templates/src/routes/gallery_page.py +0 -0
  90. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/gallery/templates/src/templates/gallery_page.twig +0 -0
  91. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/graph/__init__.py +0 -0
  92. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/graph/adapter.py +0 -0
  93. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/graph/adapters/__init__.py +0 -0
  94. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/graph/adapters/arango.py +0 -0
  95. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/graph/adapters/bolt.py +0 -0
  96. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/graph/adapters/ultipa.py +0 -0
  97. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/graph/graph_url.py +0 -0
  98. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/graphql/__init__.py +0 -0
  99. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/i18n/__init__.py +0 -0
  100. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/mcp/__init__.py +0 -0
  101. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/mcp/protocol.py +0 -0
  102. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/mcp/tools.py +0 -0
  103. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/messenger/__init__.py +0 -0
  104. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/migration/__init__.py +0 -0
  105. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/migration/runner.py +0 -0
  106. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/mqtt/__init__.py +0 -0
  107. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/mqtt/message.py +0 -0
  108. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/orm/__init__.py +0 -0
  109. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/orm/async_api.py +0 -0
  110. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/orm/collection.py +0 -0
  111. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/orm/fields.py +0 -0
  112. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/orm/model.py +0 -0
  113. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/orm/point.py +0 -0
  114. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/THIRD-PARTY-NOTICES.md +0 -0
  115. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/__feedback/widget.js +0 -0
  116. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/bundled-component-provenance.json +0 -0
  117. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/css/tina4.css +0 -0
  118. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/css/tina4.min.css +0 -0
  119. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/favicon.ico +0 -0
  120. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/images/logo.svg +0 -0
  121. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/images/tina4-logo-icon.webp +0 -0
  122. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/js/frond.js +0 -0
  123. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/js/frond.min.js +0 -0
  124. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/js/tina4-dev-admin-split.html +0 -0
  125. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/js/tina4-dev-admin.min.js +0 -0
  126. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/js/tina4.min.js +0 -0
  127. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/js/tina4js.min.js +0 -0
  128. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/licenses/swagger-ui-3.10.0-original-notice.txt +0 -0
  129. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/licenses/swagger-ui-5.17.14-NOTICE.txt +0 -0
  130. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/licenses/swagger-ui-Apache-2.0.txt +0 -0
  131. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/licenses/tina4-css-MIT.txt +0 -0
  132. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/licenses/tina4-dev-admin-components.json +0 -0
  133. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/licenses/tina4-dev-admin-third-party.txt +0 -0
  134. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/licenses/tina4-js-MIT.txt +0 -0
  135. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/swagger/index.html +0 -0
  136. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
  137. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/push/__init__.py +0 -0
  138. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/push/_base.py +0 -0
  139. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/push/_cryptography.py +0 -0
  140. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/push/_libcrypto.py +0 -0
  141. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/query_builder/__init__.py +0 -0
  142. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue/__init__.py +0 -0
  143. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue/amqp_url.py +0 -0
  144. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue/job.py +0 -0
  145. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue/kafka_backend.py +0 -0
  146. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue/lite_backend.py +0 -0
  147. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue/mongo_backend.py +0 -0
  148. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue/rabbitmq_backend.py +0 -0
  149. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue/topic_dead_letter.py +0 -0
  150. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue_backends/__init__.py +0 -0
  151. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue_backends/kafka_backend.py +0 -0
  152. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue_backends/mongo_backend.py +0 -0
  153. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/queue_backends/rabbitmq_backend.py +0 -0
  154. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/realtime/models/Attachment.py +0 -0
  155. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/realtime/models/Channel.py +0 -0
  156. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/realtime/models/ChannelMember.py +0 -0
  157. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/realtime/models/Message.py +0 -0
  158. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/realtime/models/Workspace.py +0 -0
  159. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/realtime/models/__init__.py +0 -0
  160. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/seeder/__init__.py +0 -0
  161. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/service/__init__.py +0 -0
  162. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/session/__init__.py +0 -0
  163. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/session_handlers/__init__.py +0 -0
  164. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/session_handlers/memcached_handler.py +0 -0
  165. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/session_handlers/mongodb_handler.py +0 -0
  166. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/session_handlers/redis_handler.py +0 -0
  167. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/session_handlers/valkey_handler.py +0 -0
  168. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/sso.py +0 -0
  169. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/ssrf.py +0 -0
  170. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/swagger/__init__.py +0 -0
  171. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/components/crud.twig +0 -0
  172. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/crud/modals.twig +0 -0
  173. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/crud/page.twig +0 -0
  174. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/docker/distroless/Dockerfile +0 -0
  175. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/docker/poetry/Dockerfile +0 -0
  176. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/docker/python/Dockerfile +0 -0
  177. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/docker/uv/Dockerfile +0 -0
  178. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/errors/401.twig +0 -0
  179. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/errors/403.twig +0 -0
  180. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/errors/404.twig +0 -0
  181. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/errors/500.twig +0 -0
  182. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/errors/502.twig +0 -0
  183. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/errors/503.twig +0 -0
  184. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/errors/base.twig +0 -0
  185. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/frontend/README.md +0 -0
  186. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/templates/readme.md +0 -0
  187. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/test/__init__.py +0 -0
  188. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/test_client/__init__.py +0 -0
  189. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/af/LC_MESSAGES/messages.mo +0 -0
  190. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/af/LC_MESSAGES/messages.po +0 -0
  191. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
  192. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
  193. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/es/LC_MESSAGES/messages.mo +0 -0
  194. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/es/LC_MESSAGES/messages.po +0 -0
  195. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
  196. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
  197. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/ja/LC_MESSAGES/messages.mo +0 -0
  198. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/ja/LC_MESSAGES/messages.po +0 -0
  199. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/zh/LC_MESSAGES/messages.mo +0 -0
  200. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/translations/zh/LC_MESSAGES/messages.po +0 -0
  201. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/validator/__init__.py +0 -0
  202. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/websocket/backplane.py +0 -0
  203. {tina4_python-3.13.150 → tina4_python-3.13.151}/tina4_python/wsdl/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tina4-python
3
- Version: 3.13.150
3
+ Version: 3.13.151
4
4
  Summary: Tina4 Python v3 — Zero-dependency, lightweight web framework
5
5
  Author-email: Andre van Zuydam <andrevanzuydam@gmail.com>
6
6
  License-Expression: MPL-2.0
@@ -12,7 +12,7 @@ Provides-Extra: all-db
12
12
  Requires-Dist: firebird-driver>=1.10; extra == 'all-db'
13
13
  Requires-Dist: mysql-connector-python>=9.0; extra == 'all-db'
14
14
  Requires-Dist: psycopg2-binary>=2.9; extra == 'all-db'
15
- Requires-Dist: pymongo>=4.0; extra == 'all-db'
15
+ Requires-Dist: pymongo>=4.18.2; extra == 'all-db'
16
16
  Requires-Dist: pymssql>=2.3; extra == 'all-db'
17
17
  Requires-Dist: pyodbc>=5.0; extra == 'all-db'
18
18
  Provides-Extra: arango
@@ -29,7 +29,7 @@ Requires-Dist: confluent-kafka>=2.0; extra == 'kafka'
29
29
  Provides-Extra: memcache
30
30
  Requires-Dist: pymemcache>=4.0; extra == 'memcache'
31
31
  Provides-Extra: mongo
32
- Requires-Dist: pymongo>=4.0; extra == 'mongo'
32
+ Requires-Dist: pymongo>=4.18.2; extra == 'mongo'
33
33
  Provides-Extra: mssql
34
34
  Requires-Dist: pymssql>=2.3; extra == 'mssql'
35
35
  Provides-Extra: mysql
@@ -47,9 +47,7 @@ Requires-Dist: pika>=1.3; extra == 'rabbitmq'
47
47
  Provides-Extra: redis
48
48
  Requires-Dist: redis>=5.0; extra == 'redis'
49
49
  Provides-Extra: s3
50
- Requires-Dist: boto3>=1.34; extra == 's3'
51
50
  Provides-Extra: test
52
- Requires-Dist: boto3>=1.34; extra == 'test'
53
51
  Requires-Dist: confluent-kafka>=2.0; extra == 'test'
54
52
  Requires-Dist: cryptography>=42.0; extra == 'test'
55
53
  Requires-Dist: firebird-driver>=1.10; extra == 'test'
@@ -58,7 +56,7 @@ Requires-Dist: openapi-spec-validator>=0.7; extra == 'test'
58
56
  Requires-Dist: pika>=1.3; extra == 'test'
59
57
  Requires-Dist: psycopg2-binary>=2.9; extra == 'test'
60
58
  Requires-Dist: pymemcache>=4.0; extra == 'test'
61
- Requires-Dist: pymongo>=4.0; extra == 'test'
59
+ Requires-Dist: pymongo>=4.18.2; extra == 'test'
62
60
  Requires-Dist: pymssql>=2.3; extra == 'test'
63
61
  Requires-Dist: pyodbc>=5.0; extra == 'test'
64
62
  Requires-Dist: redis>=5.0; extra == 'test'
@@ -143,7 +141,7 @@ Open http://localhost:7146
143
141
 
144
142
  ---
145
143
 
146
- ## What's Built In (55 Features)
144
+ ## What's Built In (140 Features)
147
145
 
148
146
  Every feature is built from scratch -- no pip install, no node_modules, no third-party runtime dependencies in core.
149
147
 
@@ -74,7 +74,7 @@ Open http://localhost:7146
74
74
 
75
75
  ---
76
76
 
77
- ## What's Built In (55 Features)
77
+ ## What's Built In (140 Features)
78
78
 
79
79
  Every feature is built from scratch -- no pip install, no node_modules, no third-party runtime dependencies in core.
80
80
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tina4-python"
3
- version = "3.13.150"
3
+ version = "3.13.151"
4
4
  description = "Tina4 Python v3 — Zero-dependency, lightweight web framework"
5
5
  authors = [
6
6
  {name = "Andre van Zuydam", email = "andrevanzuydam@gmail.com"}
@@ -19,7 +19,7 @@ postgres = ["psycopg2-binary>=2.9"]
19
19
  mysql = ["mysql-connector-python>=9.0"]
20
20
  mssql = ["pymssql>=2.3"]
21
21
  firebird = ["firebird-driver>=1.10"]
22
- mongo = ["pymongo>=4.0"]
22
+ mongo = ["pymongo>=4.18.2"]
23
23
  odbc = ["pyodbc>=5.0"]
24
24
 
25
25
  # Graph engine drivers — install what you need (loaded lazily on first use).
@@ -33,10 +33,13 @@ graph = ["tina4-ultipa>=0.1", "protobuf>=7.35.1", "neo4j>=5.0", "python-arango>=
33
33
  redis = ["redis>=5.0"]
34
34
  memcache = ["pymemcache>=4.0"]
35
35
 
36
- # File-storage backends — install what you need.
37
- # The `local` filesystem backend is the zero-dependency default; S3Storage
38
- # (TINA4_STORAGE_BACKEND=s3) is opt-in and imports boto3 lazily.
39
- s3 = ["boto3>=1.34"]
36
+ # File-storage backends.
37
+ # Both shipped backends are zero-dependency: `local` (filesystem, the default)
38
+ # and `s3`/S3Storage (TINA4_STORAGE_BACKEND=s3), which talks to S3/MinIO/Garage
39
+ # through Tina4's own stdlib SigV4 client (tina4_python.realtime.s3_client) — no
40
+ # boto3. The extra is kept (empty) so `pip install tina4-python[s3]` still works;
41
+ # it installs nothing because S3 needs no driver.
42
+ s3 = []
40
43
 
41
44
  # Queue backends — install what you need
42
45
  kafka = ["confluent-kafka>=2.0"]
@@ -56,7 +59,7 @@ all-db = [
56
59
  "mysql-connector-python>=9.0",
57
60
  "pymssql>=2.3",
58
61
  "firebird-driver>=1.10",
59
- "pymongo>=4.0",
62
+ "pymongo>=4.18.2",
60
63
  "pyodbc>=5.0",
61
64
  ]
62
65
 
@@ -75,28 +78,22 @@ all-db = [
75
78
  # own: `uv sync --extra X` PRUNES anything outside the named extras, so a test
76
79
  # extra that omitted it would silently uninstall it on a host that had it.
77
80
  #
78
- # boto3 is here for exactly that reason, MEASURED on the lab 2026-08-06
79
- # (Ubuntu 24.04.4 LTS x86_64, Python 3.13.3): it was declared in NO extra, but
80
- # happened to be installed ad hoc, so the two REAL-MinIO tests in
81
- # tests/test_realtime_files.py were passing. Running `uv sync --extra test`
82
- # pruned boto3 (plus s3transfer and jmespath) and those tests went straight from
83
- # "2 passed" to "2 skipped" -- with the suite still GREEN under
84
- # TINA4_REQUIRE_SERVICES=1, because the skip reason matched neither a service
85
- # keyword nor an unavailable hint in the conftest gate. Live S3 coverage
86
- # evaporated silently. Declaring it here is the fix; tests/conftest.py now also
87
- # recognises a missing boto3 so the gate can never miss it again.
81
+ # boto3 is NO LONGER here: S3Storage talks to S3 through Tina4's own stdlib
82
+ # SigV4 client, so the live-S3 tests in tests/test_realtime_files.py need no
83
+ # driver at all — only a reachable S3 server (MinIO/Garage). Removing boto3 also
84
+ # drops botocore + urllib3 + s3transfer + jmespath from the test tree, clearing
85
+ # the urllib3 advisories they carried.
88
86
  test = [
89
87
  "psycopg2-binary>=2.9",
90
88
  "mysql-connector-python>=9.0",
91
89
  "pymssql>=2.3",
92
90
  "firebird-driver>=1.10",
93
- "pymongo>=4.0",
91
+ "pymongo>=4.18.2",
94
92
  "pyodbc>=5.0",
95
93
  "redis>=5.0",
96
94
  "pymemcache>=4.0",
97
95
  "confluent-kafka>=2.0",
98
96
  "pika>=1.3",
99
- "boto3>=1.34",
100
97
  # TEST-ONLY: validates the generated OpenAPI document against the real
101
98
  # OpenAPI 3.0/3.1 schema (tests/test_swagger_contract.py). NEVER a framework
102
99
  # runtime dependency — the swagger generator itself stays zero-dependency.
@@ -477,7 +477,8 @@ async def protected_get(request, response):
477
477
 
478
478
  ```python
479
479
  request.body # Parsed request body (dict for JSON, dict for form data)
480
- request.params # Query string parameters (dict)
480
+ request.params # ROUTE params ONLY (the {id} segments) — never query/body
481
+ request.query # Query string parameters (dict) — read ?q=, ?page= here
481
482
  request.headers # HTTP headers (dict, lowercase keys)
482
483
  request.files # Uploaded files (dict, values are base64-encoded dicts)
483
484
  request.url # Request URL path
@@ -57,7 +57,7 @@ def _resolve_version() -> str:
57
57
  #
58
58
  # test_version_constant.py now asserts this literal equals the pyproject
59
59
  # version, so the release bump cannot leave it behind again.
60
- return "3.13.150"
60
+ return "3.13.151"
61
61
 
62
62
 
63
63
  __version__ = _resolve_version()
@@ -1418,7 +1418,8 @@ class ResponseCache:
1418
1418
  Authorization, and Tina4's own session mechanism IS a cookie. Because
1419
1419
  the key is method + URL, storing such a response replays one signed-in
1420
1420
  user's page to whoever asks for that URL next. A response that installs
1421
- a session is per-user by construction for the same reason.
1421
+ a session is per-user by construction for the same reason, whether it
1422
+ already carries the Set-Cookie or the session is about to add it.
1422
1423
 
1423
1424
  Both cookie cases stay cacheable when the response opts in explicitly with
1424
1425
  a shared-cache directive, which is how a genuinely public page served to
@@ -1435,6 +1436,13 @@ class ResponseCache:
1435
1436
  return _shared_cache_allowed(response)
1436
1437
  if _header_value(response, "Set-Cookie") is not None:
1437
1438
  return _shared_cache_allowed(response)
1439
+ # The session cookie is added after this check, so a response that is
1440
+ # about to install one carries no Set-Cookie yet: a request that came
1441
+ # without a cookie and leaves its session holding data (a form token
1442
+ # bound to it marks it) is that case.
1443
+ session = getattr(request, "session", None)
1444
+ if session is not None and not session.is_fresh():
1445
+ return _shared_cache_allowed(response)
1438
1446
  return True
1439
1447
 
1440
1448
  @staticmethod
@@ -589,6 +589,7 @@ class SecurityHeadersMiddleware:
589
589
  TINA4_CSP — Content-Security-Policy (default: "default-src 'self'")
590
590
  TINA4_REFERRER_POLICY — Referrer-Policy (default: strict-origin-when-cross-origin)
591
591
  TINA4_PERMISSIONS_POLICY — Permissions-Policy (default: camera=(), microphone=(), geolocation=())
592
+ TINA4_COOP — Cross-Origin-Opener-Policy (default: same-origin-allow-popups)
592
593
  """
593
594
 
594
595
  @staticmethod
@@ -647,6 +648,20 @@ class SecurityHeadersMiddleware:
647
648
  "camera=(), microphone=(), geolocation=()",
648
649
  ),
649
650
  )
651
+ # Cross-Origin-Opener-Policy severs the window-reference link to a
652
+ # cross-origin page, closing reverse-tab-nabbing and cross-window
653
+ # XS-Leaks that X-Frame-Options (framing only) does not. The default is
654
+ # same-origin-allow-popups, NOT same-origin: it isolates the page from
655
+ # whoever opened it while still letting the page talk to popups IT opens,
656
+ # so an OAuth / OIDC / payment popup that posts a token back to its opener
657
+ # keeps working out of the box. Set TINA4_COOP=same-origin for full
658
+ # isolation (the switch, with COEP, for crossOriginIsolated), or
659
+ # unsafe-none to opt out. Honoured only in a secure context — so it
660
+ # applies on https and on http://localhost, and is inert elsewhere.
661
+ response.header(
662
+ "Cross-Origin-Opener-Policy",
663
+ os.environ.get("TINA4_COOP", "same-origin-allow-popups"),
664
+ )
650
665
 
651
666
  return request, response
652
667
 
@@ -12,7 +12,8 @@ import functools
12
12
  import ipaddress
13
13
  import json
14
14
  import os
15
- from urllib.parse import parse_qs, unquote
15
+ import re
16
+ from urllib.parse import parse_qs, parse_qsl, unquote
16
17
 
17
18
  from tina4_python.env import _log_warning
18
19
 
@@ -519,8 +520,7 @@ def _parse_body(body: bytes, content_type: str) -> dict | str | None:
519
520
  return body.decode(errors="replace")
520
521
 
521
522
  if "application/x-www-form-urlencoded" in content_type:
522
- parsed = parse_qs(body.decode(), keep_blank_values=True)
523
- return {k: v[0] if len(v) == 1 else v for k, v in parsed.items()}
523
+ return _nest_form_fields(parse_qsl(body.decode(), keep_blank_values=True))
524
524
 
525
525
  if "multipart/form-data" in content_type:
526
526
  return _parse_multipart(body, content_type)
@@ -539,6 +539,7 @@ def _parse_multipart(body: bytes, content_type: str) -> dict:
539
539
  that may contain the boundary string in their content.
540
540
  """
541
541
  result = {}
542
+ fields: list[tuple[str, str]] = []
542
543
 
543
544
  # Extract boundary
544
545
  boundary = None
@@ -631,12 +632,174 @@ def _parse_multipart(body: bytes, content_type: str) -> dict:
631
632
  else:
632
633
  result[name] = descriptor
633
634
  else:
634
- result[name] = content.decode(errors="replace")
635
+ fields.append((name, content.decode(errors="replace")))
635
636
 
636
637
  if is_last:
637
638
  break
638
639
 
639
- return result
640
+ # Text fields nest after the loop. One named after a file field
641
+ # (``photo[caption]`` beside a ``photo`` upload) keeps its flat key, so it
642
+ # never collides with the file (files are separated out by key afterwards).
643
+ return {**_nest_form_fields(fields, reserved=frozenset(result)), **result}
644
+
645
+
646
+ # A field name nested deeper than this keeps its flat key. Rack's
647
+ # param_depth_limit, the same limit tina4-ruby's form parser applies.
648
+ _FORM_DEPTH_LIMIT = 32
649
+
650
+ # A form with more fields than this is not nested at all, so a crafted body
651
+ # cannot turn each small field into a deep structure. Rack's params_limit.
652
+ _FORM_FIELD_LIMIT = 4096
653
+
654
+ # A field name longer than this keeps its flat key, so nesting never copies a
655
+ # huge name once per level.
656
+ _FORM_NAME_LIMIT = 1024
657
+
658
+
659
+ class _FormNestError(ValueError):
660
+ """A field name that is both a value and a container."""
661
+
662
+
663
+ class _Nested(dict):
664
+ """A dict built by nesting, as opposed to a value that happens to be one."""
665
+
666
+
667
+ def _nest_form_fields(pairs, reserved=frozenset()) -> dict:
668
+ """Nest ``(name, value)`` form pairs the way PHP and Rack nest a form.
669
+
670
+ ``tags[]`` collects a list, ``user[name]`` builds a dict, ``a[][x]`` a list
671
+ of dicts, and a repeated plain name keeps every value as a list. Used for
672
+ urlencoded and multipart bodies alike, so a form arrives in one shape
673
+ however it was encoded. A field that cannot nest - its name conflicts with
674
+ an earlier one (``a=1`` then ``a[b]=2``), nests too deep, is longer than
675
+ ``_FORM_NAME_LIMIT``, or starts with a ``reserved`` name (a file field's) -
676
+ keeps its flat key; the rest still nest. A later plain name replaces a dict
677
+ of that name, as Rack and parse_str do, and joins a list.
678
+ """
679
+ params = _Nested()
680
+ if len(pairs) > _FORM_FIELD_LIMIT:
681
+ for name, value in pairs:
682
+ _append_value(params, name, value)
683
+ return _plain(params)
684
+ for name, value in pairs:
685
+ base = name.split("[", 1)[0] if name.find("[", 1) != -1 else name
686
+ if base in reserved or len(name) > _FORM_NAME_LIMIT or name.count("[") >= _FORM_DEPTH_LIMIT:
687
+ _append_value(params, name, value)
688
+ continue
689
+ try:
690
+ _nest_one(params, name, value, 0)
691
+ except _FormNestError:
692
+ _append_value(params, name, value)
693
+ return _plain(params)
694
+
695
+
696
+ def _append_value(params: dict, key: str, value) -> None:
697
+ """Store a plain field; a repeat turns it into a list of every value."""
698
+ if key not in params:
699
+ params[key] = value
700
+ elif isinstance(params[key], _RepeatedValues):
701
+ params[key].append(value)
702
+ else:
703
+ params[key] = _RepeatedValues([params[key], value])
704
+
705
+
706
+ class _RepeatedValues(list):
707
+ """The values of a repeated plain field name (``p=1&p=2``)."""
708
+
709
+
710
+ def _nest_one(params: dict, name: str, value, depth: int):
711
+ """Rack::QueryParser#normalize_params, ported from tina4-ruby's form parser.
712
+
713
+ It raises where Rack raises on a conflict; a plain name after a list of
714
+ that name joins the list, where Rack would replace it.
715
+ """
716
+ key, after = _split_field_name(name, depth)
717
+ if not key:
718
+ return None
719
+ if not after:
720
+ return _nest_leaf(params, key, value, depth)
721
+ if after == "[":
722
+ params[name] = value
723
+ elif after == "[]":
724
+ _list_at(params, key).append(value)
725
+ elif after.startswith("[]"):
726
+ _nest_list_item(_list_at(params, key), after, value, depth)
727
+ else:
728
+ current = params.setdefault(key, _Nested())
729
+ if not isinstance(current, _Nested):
730
+ raise _FormNestError(f"expected a dict for {key!r}")
731
+ params[key] = _nest_one(current, after, value, depth + 1)
732
+ return params
733
+
734
+
735
+ def _split_field_name(name: str, depth: int) -> tuple[str, str]:
736
+ """The next key of a field name, and the bracketed rest after it."""
737
+ if depth == 0:
738
+ start = name.find("[", 1)
739
+ return (name[:start], name[start:]) if start != -1 else (name, "")
740
+ if name.startswith("[]"):
741
+ return "[]", name[2:]
742
+ close = name.find("]", 1)
743
+ if name.startswith("[") and close != -1:
744
+ return name[1:close], name[close + 1:]
745
+ return name, ""
746
+
747
+
748
+ def _nest_leaf(params: dict, key: str, value, depth: int):
749
+ if key == "[]" and depth:
750
+ return [value]
751
+ if depth:
752
+ params[key] = value
753
+ return params
754
+ # A plain name after a list of that name joins the list (``tags[]=1&tags=2``);
755
+ # after a dict it replaces it, as Rack and parse_str do.
756
+ existing = params.get(key)
757
+ if isinstance(existing, list) and not isinstance(existing, _RepeatedValues):
758
+ existing.append(value)
759
+ elif isinstance(existing, _Nested):
760
+ params[key] = value
761
+ else:
762
+ _append_value(params, key, value)
763
+ return params
764
+
765
+
766
+ def _list_at(params: dict, key: str) -> list:
767
+ current = params.setdefault(key, [])
768
+ if not isinstance(current, list) or isinstance(current, _RepeatedValues):
769
+ raise _FormNestError(f"expected a list for {key!r}")
770
+ return current
771
+
772
+
773
+ def _nest_list_item(items: list, after: str, value, depth: int) -> None:
774
+ """``a[][x]``: fill the last record unless it already has ``x``, else start one."""
775
+ child_key = after[3:-1] if after[2:3] == "[" and after.endswith("]") else ""
776
+ if not child_key or "[" in child_key or "]" in child_key:
777
+ child_key = after[2:]
778
+ last = items[-1] if items else None
779
+ if isinstance(last, _Nested) and not _has_nested_key(last, child_key):
780
+ _nest_one(last, child_key, value, depth + 1)
781
+ else:
782
+ items.append(_nest_one(_Nested(), child_key, value, depth + 1))
783
+
784
+
785
+ def _has_nested_key(params: dict, key: str) -> bool:
786
+ if "[]" in key:
787
+ return False
788
+ level = params
789
+ for part in [p for p in re.split(r"[\[\]]+", key) if p]:
790
+ if not isinstance(level, _Nested) or part not in level:
791
+ return False
792
+ level = level[part]
793
+ return True
794
+
795
+
796
+ def _plain(value):
797
+ """Turn the nesting markers back into ordinary dicts and lists."""
798
+ if isinstance(value, dict):
799
+ return {k: _plain(v) for k, v in value.items()}
800
+ if isinstance(value, list):
801
+ return [_plain(v) for v in value]
802
+ return value
640
803
 
641
804
 
642
805
  def _is_file_value(value) -> bool:
@@ -646,11 +809,11 @@ def _is_file_value(value) -> bool:
646
809
  non-empty list of such descriptors (a repeated field name). Everything else
647
810
  is a plain form field.
648
811
  """
649
- if isinstance(value, dict):
650
- return "filename" in value
651
812
  if isinstance(value, list):
652
- return bool(value) and isinstance(value[0], dict) and "filename" in value[0]
653
- return False
813
+ return bool(value) and _is_file_value(value[0])
814
+ # Content is bytes only on a real upload; a nested text field such as
815
+ # doc[filename]=x is a dict too, but every value in it is a str.
816
+ return isinstance(value, dict) and "filename" in value and isinstance(value.get("content"), bytes)
654
817
 
655
818
 
656
819
  def save_upload(file: dict, target_dir: str, filename: str | None = None) -> str:
@@ -683,7 +846,7 @@ def save_upload(file: dict, target_dir: str, filename: str | None = None) -> str
683
846
  os.makedirs(target_dir, exist_ok=True)
684
847
  dest = os.path.join(target_dir, base)
685
848
  # Defence in depth: the resolved parent of the destination must be exactly
686
- # the resolved target dir (guards a pre-existing symlink at target/base).
849
+ # the resolved target dir.
687
850
  real_dir = os.path.realpath(target_dir)
688
851
  real_parent = os.path.realpath(os.path.dirname(dest))
689
852
  if real_parent != real_dir:
@@ -691,6 +854,22 @@ def save_upload(file: dict, target_dir: str, filename: str | None = None) -> str
691
854
  content = file.get("content", b"")
692
855
  if isinstance(content, str):
693
856
  content = content.encode()
694
- with open(dest, "wb") as handle:
857
+ # Never write THROUGH a link already at target/base: a symlink (even a
858
+ # dangling one) leads out of target_dir, and a hard link shares its bytes
859
+ # with a file elsewhere. Such an entry is removed so the upload gets a file
860
+ # of its own; a plain file is rewritten in place and keeps its mode.
861
+ if os.path.islink(dest):
862
+ os.unlink(dest)
863
+ flags = os.O_WRONLY | os.O_CREAT | getattr(os, "O_NOFOLLOW", 0) | getattr(os, "O_BINARY", 0)
864
+ # 0o600: an uploaded file is created owner-only, never group/other readable
865
+ # or writable (CWE-732). The mode applies only when O_CREAT makes the file;
866
+ # a plain file rewritten in place keeps its own mode, per the note above.
867
+ fd = os.open(dest, flags, 0o600)
868
+ if os.fstat(fd).st_nlink > 1:
869
+ os.close(fd)
870
+ os.unlink(dest)
871
+ fd = os.open(dest, flags | os.O_EXCL, 0o600)
872
+ with os.fdopen(fd, "wb") as handle:
873
+ handle.truncate(0)
695
874
  handle.write(content)
696
875
  return dest
@@ -2923,6 +2923,29 @@ _RESPONSE_STAGES = (
2923
2923
  _stage_head_strip,
2924
2924
  )
2925
2925
 
2926
+ #: Response stages that do BLOCKING I/O and must run off the event loop (via
2927
+ #: asyncio.to_thread in the dispatch runner), so one request's session write or
2928
+ #: log write never freezes the loop for every other in-flight request. The rest
2929
+ #: of _RESPONSE_STAGES is CPU-only and stays on the loop. See the LOAD offload in
2930
+ #: handle() and the handler threading in _invoke_handler (ADR-0074).
2931
+ _OFFLOAD_RESPONSE_STAGES = frozenset({_stage_request_log, _stage_session_save})
2932
+
2933
+
2934
+ async def _run_response_stage(stage, ctx: "DispatchContext") -> None:
2935
+ """Run one response stage, OFF the event loop if it does blocking I/O.
2936
+
2937
+ Session SAVE (backend write) and the request-log file write block; offload
2938
+ those to a worker thread so one request's I/O never freezes the loop for the
2939
+ rest. The CPU-only stages (headers, CORS, toolbar, HEAD strip) stay on the
2940
+ loop. ctx is request-local, so running a stage in a thread is safe. The
2941
+ branch lives HERE, not in handle(), so the dispatch runner stays flat
2942
+ (test_dispatch_pipeline::test_the_god_function_does_not_come_back).
2943
+ """
2944
+ if stage in _OFFLOAD_RESPONSE_STAGES:
2945
+ await asyncio.to_thread(stage, ctx)
2946
+ else:
2947
+ stage(ctx)
2948
+
2926
2949
 
2927
2950
  def _resolve_request_id(request: Request) -> str:
2928
2951
  """Honour a well-formed inbound X-Request-ID (sanitized), else generate one.
@@ -2959,8 +2982,18 @@ async def handle(request: Request) -> Response:
2959
2982
  from tina4_python.core.csp import generate_nonce, set_current_nonce, clear_current_nonce
2960
2983
  request_nonce = generate_nonce()
2961
2984
  set_current_nonce(request_nonce)
2985
+ from tina4_python.frond.engine import set_request_session, reset_request_session
2986
+ session_token = set_request_session(None)
2962
2987
  try:
2963
- _init_session(request)
2988
+ # Session LOAD reads the backend (Redis/Valkey/memcached/MongoDB do a
2989
+ # blocking socket round-trip; the file backend a blocking file read).
2990
+ # Offload it so it does not freeze the loop — the handler was threaded
2991
+ # for the same reason (ADR-0074), but only the handler was. The Session
2992
+ # and its backend connection are request-local, so a worker thread adds
2993
+ # no cross-request sharing.
2994
+ await asyncio.to_thread(_init_session, request)
2995
+ # form_token() binds each token to this request's session (CSRF).
2996
+ set_request_session(request.session)
2964
2997
 
2965
2998
  response = Response()
2966
2999
  response.csp_nonce = request_nonce
@@ -2984,7 +3017,7 @@ async def handle(request: Request) -> Response:
2984
3017
  break
2985
3018
 
2986
3019
  for stage in _RESPONSE_STAGES:
2987
- stage(ctx)
3020
+ await _run_response_stage(stage, ctx)
2988
3021
 
2989
3022
  return ctx.response
2990
3023
  finally:
@@ -2994,6 +3027,7 @@ async def handle(request: Request) -> Response:
2994
3027
  # already finished. The CSP nonce has the same lifetime.
2995
3028
  clear_request_id()
2996
3029
  clear_current_nonce()
3030
+ reset_request_session(session_token)
2997
3031
 
2998
3032
  def asgi(root_dir: str = "src"):
2999
3033
  """Build the ASGI application, with routes discovered.
@@ -3820,6 +3854,7 @@ def _find_available_port(start: int, max_tries: int = 10) -> int:
3820
3854
  import socket
3821
3855
  try:
3822
3856
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
3857
+ s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
3823
3858
  s.bind(("127.0.0.1", start))
3824
3859
  s.close()
3825
3860
  return start
@@ -143,7 +143,7 @@ class Crud:
143
143
  verb = str(method).upper()
144
144
  return render.render_template("crud/form.twig", {
145
145
  "wrap": True,
146
- "form_id_attr": "",
146
+ "form_id": "",
147
147
  "action": render.escape_html(action),
148
148
  "form_method": render.escape_html(verb),
149
149
  "method_override": verb if verb in ("PUT", "PATCH", "DELETE") else None,
@@ -108,7 +108,7 @@ def table_data(*, columns, records, pk, table_name, editable, sortable,
108
108
  "readonly": not editable,
109
109
  "inline_script": inline_script,
110
110
  "table_name": escape_html(table_name),
111
- "table_id_attr": (f' id="{escape_html(table_id)}"' if table_id else ""),
111
+ "table_id": (table_id if table_id else ""),
112
112
  }
113
113
 
114
114
 
@@ -131,12 +131,12 @@ def render_modal_form(mode, columns, pk, *, edit):
131
131
  "value": "",
132
132
  "placeholder": escape_html(f"Enter {label.lower()}"),
133
133
  "type": "text",
134
- "required_attr": "",
134
+ "required": False,
135
135
  "input": True,
136
136
  })
137
137
  return render_template("crud/form.twig", {
138
138
  "wrap": True,
139
- "form_id_attr": f' id="form-{mode}"',
139
+ "form_id": f"form-{mode}",
140
140
  "action": "",
141
141
  "form_method": "POST",
142
142
  "method_override": None,
@@ -159,7 +159,7 @@ def build_custom_field(field):
159
159
  "label": escape_html(str(label)),
160
160
  "value": escape_html("" if value is None else str(value)),
161
161
  "placeholder": "",
162
- "required_attr": " required" if field.get("required") else "",
162
+ "required": bool(field.get("required")),
163
163
  }
164
164
  ftype = field.get("type") or "string"
165
165
  ftype = ftype if isinstance(ftype, str) else str(ftype)
@@ -182,7 +182,7 @@ def _field_type_attrs(ftype, field, value):
182
182
  if ftype == "text":
183
183
  return {"textarea": True}
184
184
  if ftype == "boolean":
185
- return {"checkbox": True, "checked_attr": (" checked" if value else "")}
185
+ return {"checkbox": True, "checked": bool(value)}
186
186
  if ftype == "select":
187
187
  return {"select": True, "options_html": build_options(field.get("options"), value)}
188
188
  return {"input": True, "type": _INPUT_TYPES.get(ftype, "text")}
@@ -44,7 +44,11 @@ def _run(path: str) -> dict:
44
44
  raise MetricsEngineError(f"tina4 not found on PATH - {_INSTALL_HINT}")
45
45
  try:
46
46
  process = subprocess.run(
47
- [binary, "metrics", "--path", path, "--json"],
47
+ # --no-history: a dashboard READ must never write .tina4-metrics.json.
48
+ # Without it every scan records history, the file watcher sees the
49
+ # write and reloads the page, which re-scans - a self-inflicted
50
+ # ~2-second reload loop that makes the dashboard unusable.
51
+ [binary, "metrics", "--path", path, "--json", "--no-history"],
48
52
  capture_output=True,
49
53
  text=True,
50
54
  timeout=_TIMEOUT_SECONDS,