tina4-python 3.13.163__tar.gz → 3.13.164__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 (204) hide show
  1. {tina4_python-3.13.163 → tina4_python-3.13.164}/PKG-INFO +9 -9
  2. {tina4_python-3.13.163 → tina4_python-3.13.164}/pyproject.toml +9 -9
  3. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/__init__.py +1 -1
  4. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/ai/__init__.py +2 -2
  5. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/cli/__init__.py +7 -3
  6. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/port_takeover.py +53 -12
  7. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/response.py +6 -2
  8. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/server.py +34 -3
  9. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/dev_admin/__init__.py +27 -9
  10. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/frond/engine.py +60 -19
  11. {tina4_python-3.13.163 → tina4_python-3.13.164}/.gitignore +0 -0
  12. {tina4_python-3.13.163 → tina4_python-3.13.164}/COMMERCIAL-LICENSE.md +0 -0
  13. {tina4_python-3.13.163 → tina4_python-3.13.164}/LICENSE +0 -0
  14. {tina4_python-3.13.163 → tina4_python-3.13.164}/NOTICE +0 -0
  15. {tina4_python-3.13.163 → tina4_python-3.13.164}/README.md +0 -0
  16. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/.tina4-metrics.json +0 -0
  17. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/CLAUDE.md +0 -0
  18. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/HtmlElement.py +0 -0
  19. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/Testing.py +0 -0
  20. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/_import_helper.py +0 -0
  21. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/_testing_async.py +0 -0
  22. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/ai/client.py +0 -0
  23. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/api/__init__.py +0 -0
  24. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/auth/__init__.py +0 -0
  25. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/cache/__init__.py +0 -0
  26. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/container/__init__.py +0 -0
  27. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/context/__init__.py +0 -0
  28. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/context/chunker.py +0 -0
  29. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/__init__.py +0 -0
  30. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/cache.py +0 -0
  31. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/constants.py +0 -0
  32. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/csp.py +0 -0
  33. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/events.py +0 -0
  34. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/middleware.py +0 -0
  35. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/rate_limiter.py +0 -0
  36. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/request.py +0 -0
  37. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/core/router.py +0 -0
  38. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/crud/__init__.py +0 -0
  39. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/crud/page.py +0 -0
  40. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/crud/page_render.py +0 -0
  41. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/__init__.py +0 -0
  42. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/adapter.py +0 -0
  43. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/async_api.py +0 -0
  44. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/connection.py +0 -0
  45. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/database_url.py +0 -0
  46. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/firebird.py +0 -0
  47. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/mongodb.py +0 -0
  48. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/mssql.py +0 -0
  49. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/mysql.py +0 -0
  50. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/odbc.py +0 -0
  51. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/pool.py +0 -0
  52. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/postgres.py +0 -0
  53. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/sql_translator.py +0 -0
  54. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/database/sqlite.py +0 -0
  55. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/debug/__init__.py +0 -0
  56. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/debug/error_overlay.py +0 -0
  57. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/dev_admin/metrics.py +0 -0
  58. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/dev_admin/plan.py +0 -0
  59. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/dev_admin/project_index.py +0 -0
  60. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/docs.py +0 -0
  61. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/docstore/__init__.py +0 -0
  62. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/dotenv/__init__.py +0 -0
  63. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/env.py +0 -0
  64. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/frond/FROND.md +0 -0
  65. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/frond/__init__.py +0 -0
  66. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/frond/compiler.py +0 -0
  67. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/frond/parser.py +0 -0
  68. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/auth/meta.json +0 -0
  69. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/auth/src/routes/api/gallery_auth.py +0 -0
  70. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/database/meta.json +0 -0
  71. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/database/src/routes/api/gallery_db.py +0 -0
  72. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/error-overlay/meta.json +0 -0
  73. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/error-overlay/src/routes/api/gallery_crash.py +0 -0
  74. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/orm/meta.json +0 -0
  75. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/orm/src/orm/Product.py +0 -0
  76. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/orm/src/routes/api/gallery_products.py +0 -0
  77. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/queue/meta.json +0 -0
  78. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/queue/src/routes/api/gallery_queue.py +0 -0
  79. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/rest-api/meta.json +0 -0
  80. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/rest-api/src/routes/api/gallery_hello.py +0 -0
  81. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/templates/meta.json +0 -0
  82. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/templates/src/routes/gallery_page.py +0 -0
  83. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/gallery/templates/src/templates/gallery_page.twig +0 -0
  84. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/graph/__init__.py +0 -0
  85. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/graph/adapter.py +0 -0
  86. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/graph/adapters/__init__.py +0 -0
  87. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/graph/adapters/arango.py +0 -0
  88. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/graph/adapters/bolt.py +0 -0
  89. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/graph/adapters/ultipa.py +0 -0
  90. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/graph/graph_url.py +0 -0
  91. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/graphql/__init__.py +0 -0
  92. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/i18n/__init__.py +0 -0
  93. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/mcp/__init__.py +0 -0
  94. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/mcp/protocol.py +0 -0
  95. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/mcp/tools.py +0 -0
  96. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/messenger/__init__.py +0 -0
  97. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/migration/__init__.py +0 -0
  98. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/migration/runner.py +0 -0
  99. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/mqtt/__init__.py +0 -0
  100. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/mqtt/message.py +0 -0
  101. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/orm/__init__.py +0 -0
  102. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/orm/async_api.py +0 -0
  103. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/orm/collection.py +0 -0
  104. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/orm/fields.py +0 -0
  105. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/orm/model.py +0 -0
  106. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/orm/point.py +0 -0
  107. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/THIRD-PARTY-NOTICES.md +0 -0
  108. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/__feedback/widget.js +0 -0
  109. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/bundled-component-provenance.json +0 -0
  110. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/css/tina4.css +0 -0
  111. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/css/tina4.min.css +0 -0
  112. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/favicon.ico +0 -0
  113. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/images/logo.svg +0 -0
  114. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/images/tina4-logo-icon.webp +0 -0
  115. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/js/frond.js +0 -0
  116. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/js/frond.min.js +0 -0
  117. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/js/tina4-dev-admin-split.html +0 -0
  118. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/js/tina4-dev-admin.min.js +0 -0
  119. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/js/tina4.min.js +0 -0
  120. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/js/tina4js.min.js +0 -0
  121. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/licenses/swagger-ui-3.10.0-original-notice.txt +0 -0
  122. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/licenses/swagger-ui-5.17.14-NOTICE.txt +0 -0
  123. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/licenses/swagger-ui-Apache-2.0.txt +0 -0
  124. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/licenses/tina4-css-MIT.txt +0 -0
  125. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/licenses/tina4-dev-admin-components.json +0 -0
  126. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/licenses/tina4-dev-admin-third-party.txt +0 -0
  127. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/licenses/tina4-js-MIT.txt +0 -0
  128. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/swagger/index.html +0 -0
  129. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
  130. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/push/__init__.py +0 -0
  131. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/push/_base.py +0 -0
  132. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/push/_cryptography.py +0 -0
  133. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/push/_libcrypto.py +0 -0
  134. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/query_builder/__init__.py +0 -0
  135. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue/__init__.py +0 -0
  136. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue/amqp_url.py +0 -0
  137. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue/job.py +0 -0
  138. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue/kafka_backend.py +0 -0
  139. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue/lite_backend.py +0 -0
  140. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue/mongo_backend.py +0 -0
  141. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue/rabbitmq_backend.py +0 -0
  142. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue/topic_dead_letter.py +0 -0
  143. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue_backends/__init__.py +0 -0
  144. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue_backends/kafka_backend.py +0 -0
  145. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue_backends/mongo_backend.py +0 -0
  146. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/queue_backends/rabbitmq_backend.py +0 -0
  147. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/realtime/__init__.py +0 -0
  148. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/realtime/models/Attachment.py +0 -0
  149. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/realtime/models/Channel.py +0 -0
  150. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/realtime/models/ChannelMember.py +0 -0
  151. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/realtime/models/Message.py +0 -0
  152. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/realtime/models/Workspace.py +0 -0
  153. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/realtime/models/__init__.py +0 -0
  154. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/realtime/s3_client.py +0 -0
  155. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/realtime/storage.py +0 -0
  156. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/seeder/__init__.py +0 -0
  157. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/service/__init__.py +0 -0
  158. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/session/__init__.py +0 -0
  159. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/session_handlers/__init__.py +0 -0
  160. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/session_handlers/memcached_handler.py +0 -0
  161. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/session_handlers/mongodb_handler.py +0 -0
  162. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/session_handlers/redis_handler.py +0 -0
  163. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/session_handlers/valkey_handler.py +0 -0
  164. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/sso.py +0 -0
  165. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/ssrf.py +0 -0
  166. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/swagger/__init__.py +0 -0
  167. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/tcp/__init__.py +0 -0
  168. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/components/crud.twig +0 -0
  169. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/crud/form.twig +0 -0
  170. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/crud/modals.twig +0 -0
  171. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/crud/page.twig +0 -0
  172. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/crud/table.twig +0 -0
  173. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/docker/distroless/Dockerfile +0 -0
  174. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/docker/poetry/Dockerfile +0 -0
  175. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/docker/python/Dockerfile +0 -0
  176. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/docker/uv/Dockerfile +0 -0
  177. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/errors/302.twig +0 -0
  178. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/errors/401.twig +0 -0
  179. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/errors/403.twig +0 -0
  180. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/errors/404.twig +0 -0
  181. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/errors/500.twig +0 -0
  182. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/errors/502.twig +0 -0
  183. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/errors/503.twig +0 -0
  184. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/errors/base.twig +0 -0
  185. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/frontend/README.md +0 -0
  186. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/templates/readme.md +0 -0
  187. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/test/__init__.py +0 -0
  188. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/test_client/__init__.py +0 -0
  189. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/af/LC_MESSAGES/messages.mo +0 -0
  190. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/af/LC_MESSAGES/messages.po +0 -0
  191. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
  192. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
  193. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/es/LC_MESSAGES/messages.mo +0 -0
  194. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/es/LC_MESSAGES/messages.po +0 -0
  195. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
  196. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
  197. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/ja/LC_MESSAGES/messages.mo +0 -0
  198. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/ja/LC_MESSAGES/messages.po +0 -0
  199. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/zh/LC_MESSAGES/messages.mo +0 -0
  200. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/translations/zh/LC_MESSAGES/messages.po +0 -0
  201. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/validator/__init__.py +0 -0
  202. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/websocket/__init__.py +0 -0
  203. {tina4_python-3.13.163 → tina4_python-3.13.164}/tina4_python/websocket/backplane.py +0 -0
  204. {tina4_python-3.13.163 → tina4_python-3.13.164}/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.163
3
+ Version: 3.13.164
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
@@ -10,9 +10,9 @@ License-File: NOTICE
10
10
  Requires-Python: >=3.12
11
11
  Provides-Extra: all-db
12
12
  Requires-Dist: firebird-driver>=1.10; extra == 'all-db'
13
- Requires-Dist: mysql-connector-python>=9.0; extra == 'all-db'
13
+ Requires-Dist: mysql-connector-python>=9.1.0; extra == 'all-db'
14
14
  Requires-Dist: psycopg2-binary>=2.9; extra == 'all-db'
15
- Requires-Dist: pymongo>=4.18.2; extra == 'all-db'
15
+ Requires-Dist: pymongo>=4.18.3; 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,11 +29,11 @@ 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.18.2; extra == 'mongo'
32
+ Requires-Dist: pymongo>=4.18.3; extra == 'mongo'
33
33
  Provides-Extra: mssql
34
34
  Requires-Dist: pymssql>=2.3; extra == 'mssql'
35
35
  Provides-Extra: mysql
36
- Requires-Dist: mysql-connector-python>=9.0; extra == 'mysql'
36
+ Requires-Dist: mysql-connector-python>=9.1.0; extra == 'mysql'
37
37
  Provides-Extra: neo4j
38
38
  Requires-Dist: neo4j>=5.0; extra == 'neo4j'
39
39
  Provides-Extra: odbc
@@ -41,7 +41,7 @@ Requires-Dist: pyodbc>=5.0; extra == 'odbc'
41
41
  Provides-Extra: postgres
42
42
  Requires-Dist: psycopg2-binary>=2.9; extra == 'postgres'
43
43
  Provides-Extra: push
44
- Requires-Dist: cryptography>=42.0; extra == 'push'
44
+ Requires-Dist: cryptography>=50.0.0; extra == 'push'
45
45
  Provides-Extra: rabbitmq
46
46
  Requires-Dist: pika>=1.3; extra == 'rabbitmq'
47
47
  Provides-Extra: redis
@@ -49,14 +49,14 @@ Requires-Dist: redis>=5.0; extra == 'redis'
49
49
  Provides-Extra: s3
50
50
  Provides-Extra: test
51
51
  Requires-Dist: confluent-kafka>=2.0; extra == 'test'
52
- Requires-Dist: cryptography>=42.0; extra == 'test'
52
+ Requires-Dist: cryptography>=50.0.0; extra == 'test'
53
53
  Requires-Dist: firebird-driver>=1.10; extra == 'test'
54
- Requires-Dist: mysql-connector-python>=9.0; extra == 'test'
54
+ Requires-Dist: mysql-connector-python>=9.1.0; extra == 'test'
55
55
  Requires-Dist: openapi-spec-validator>=0.7; extra == 'test'
56
56
  Requires-Dist: pika>=1.3; extra == 'test'
57
57
  Requires-Dist: psycopg2-binary>=2.9; extra == 'test'
58
58
  Requires-Dist: pymemcache>=4.0; extra == 'test'
59
- Requires-Dist: pymongo>=4.18.2; extra == 'test'
59
+ Requires-Dist: pymongo>=4.18.3; extra == 'test'
60
60
  Requires-Dist: pymssql>=2.3; extra == 'test'
61
61
  Requires-Dist: pyodbc>=5.0; extra == 'test'
62
62
  Requires-Dist: redis>=5.0; extra == 'test'
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tina4-python"
3
- version = "3.13.163"
3
+ version = "3.13.164"
4
4
  description = "Tina4 Python v3 — Zero-dependency, lightweight web framework"
5
5
  authors = [
6
6
  {name = "Andre van Zuydam", email = "andrevanzuydam@gmail.com"}
@@ -16,10 +16,10 @@ dependencies = []
16
16
  [project.optional-dependencies]
17
17
  # Database drivers — install what you need
18
18
  postgres = ["psycopg2-binary>=2.9"]
19
- mysql = ["mysql-connector-python>=9.0"]
19
+ mysql = ["mysql-connector-python>=9.1.0"]
20
20
  mssql = ["pymssql>=2.3"]
21
21
  firebird = ["firebird-driver>=1.10"]
22
- mongo = ["pymongo>=4.18.2"]
22
+ mongo = ["pymongo>=4.18.3"]
23
23
  odbc = ["pyodbc>=5.0"]
24
24
 
25
25
  # Graph engine drivers — install what you need (loaded lazily on first use).
@@ -51,15 +51,15 @@ rabbitmq = ["pika>=1.3"]
51
51
  # cannot reach a safe OpenSSL, so the cryptography package runs instead. Install
52
52
  # it there (or pin it with TINA4_PUSH_BACKEND=cryptography); the wire output is
53
53
  # identical either way. See tina4_python/push/_libcrypto.py.
54
- push = ["cryptography>=42.0"]
54
+ push = ["cryptography>=50.0.0"]
55
55
 
56
56
  # All database drivers
57
57
  all-db = [
58
58
  "psycopg2-binary>=2.9",
59
- "mysql-connector-python>=9.0",
59
+ "mysql-connector-python>=9.1.0",
60
60
  "pymssql>=2.3",
61
61
  "firebird-driver>=1.10",
62
- "pymongo>=4.18.2",
62
+ "pymongo>=4.18.3",
63
63
  "pyodbc>=5.0",
64
64
  ]
65
65
 
@@ -85,10 +85,10 @@ all-db = [
85
85
  # the urllib3 advisories they carried.
86
86
  test = [
87
87
  "psycopg2-binary>=2.9",
88
- "mysql-connector-python>=9.0",
88
+ "mysql-connector-python>=9.1.0",
89
89
  "pymssql>=2.3",
90
90
  "firebird-driver>=1.10",
91
- "pymongo>=4.18.2",
91
+ "pymongo>=4.18.3",
92
92
  "pyodbc>=5.0",
93
93
  "redis>=5.0",
94
94
  "pymemcache>=4.0",
@@ -99,7 +99,7 @@ test = [
99
99
  # runtime dependency — the swagger generator itself stays zero-dependency.
100
100
  "openapi-spec-validator>=0.7",
101
101
  # TEST-ONLY: exercises Feature 140's optional native crypto capability.
102
- "cryptography>=42.0",
102
+ "cryptography>=50.0.0",
103
103
  ]
104
104
 
105
105
  [dependency-groups]
@@ -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.163"
60
+ return "3.13.164"
61
61
 
62
62
 
63
63
  __version__ = _resolve_version()
@@ -497,8 +497,8 @@ def generate_context(tool_name: str = "claude-code") -> str:
497
497
  async def list_users(request, response):
498
498
  return response({"users": []})
499
499
 
500
- @post("/api/users")
501
500
  @noauth()
501
+ @post("/api/users")
502
502
  async def create_user(request, response):
503
503
  return response({"created": request.body["name"]}, 201)'''
504
504
 
@@ -719,7 +719,7 @@ This project uses Tina4 Python. All features are built in — do not install ext
719
719
  ## CLI
720
720
 
721
721
  ```bash
722
- tina4python serve # Dev server on port 7145
722
+ tina4python serve # Dev server on port 7146
723
723
  tina4python migrate # Run migrations
724
724
  tina4python test # Run tests
725
725
  tina4python routes # List routes
@@ -288,7 +288,7 @@ from tina4_python.core.port_takeover import ( # noqa: E402
288
288
  )
289
289
 
290
290
 
291
- def _kill_process_on_port(port: int) -> bool:
291
+ def _kill_process_on_port(port: int, host: str | None = None) -> bool:
292
292
  """Reclaim *port* from a stale Tina4 dev server, only when it is safe.
293
293
 
294
294
  Routes through the shared identity-checked takeover (TAKEOVER-DEC-01/02):
@@ -297,9 +297,12 @@ def _kill_process_on_port(port: int) -> bool:
297
297
  printed; takeover is also skipped in a container, outside dev mode, and when
298
298
  opted out (`TINA4_NO_TAKEOVER` / `tina4 serve --no-kill`).
299
299
 
300
+ *host* is the address serve will bind; when given, a port that binds there
301
+ is reported as free instead of "in use".
302
+
300
303
  Returns True only when a Tina4 holder was actually signalled.
301
304
  """
302
- result = take_over_port(port, dev=is_dev(), no_takeover=no_takeover_opted_out())
305
+ result = take_over_port(port, dev=is_dev(), no_takeover=no_takeover_opted_out(), host=host)
303
306
  if result.reclaimed:
304
307
  print(f" ⚠ {result.message}")
305
308
  return True
@@ -864,7 +867,8 @@ def _serve(args):
864
867
 
865
868
  # Reclaim the port from a stale Tina4 dev server only (identity-checked).
866
869
  port = cli_port or int(os.environ.get("PORT", os.environ.get("TINA4_PORT", "7146")))
867
- _kill_process_on_port(port)
870
+ from tina4_python.core.server import resolve_config
871
+ _kill_process_on_port(port, host=resolve_config(cli_host=cli_host, cli_port=port)[0])
868
872
 
869
873
  from tina4_python.core import run
870
874
  run(host=cli_host, port=cli_port, no_browser=no_browser, no_reload=no_reload)
@@ -44,6 +44,7 @@ from __future__ import annotations
44
44
 
45
45
  import os
46
46
  import signal
47
+ import socket
47
48
  import subprocess
48
49
  import sys
49
50
  from dataclasses import dataclass, field
@@ -233,6 +234,49 @@ def _port_holders(port: int) -> list[str]:
233
234
  return []
234
235
 
235
236
 
237
+ def _bindable(host: str, port: int) -> bool:
238
+ """True when a plain TCP listener on *host*:*port* binds right now.
239
+
240
+ SO_REUSEADDR off Windows only, as the server's own bind does: on POSIX it
241
+ lets a TIME_WAIT leftover pass but still fails against a live listener;
242
+ on Windows it would let the probe bind over a live listener.
243
+ """
244
+ family = socket.AF_INET6 if ":" in host else socket.AF_INET
245
+ try:
246
+ with socket.socket(family, socket.SOCK_STREAM) as probe:
247
+ if sys.platform != "win32":
248
+ probe.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
249
+ probe.bind((host.strip("[]"), port))
250
+ probe.listen(1)
251
+ except (OSError, ValueError, OverflowError):
252
+ return False
253
+ return True
254
+
255
+
256
+ def _refusal(port: int, dev: bool, no_takeover: bool, host: str | None) -> TakeoverResult | None:
257
+ """The result to return before any holder lookup, or None to carry on.
258
+
259
+ Takeover is refused when opted out or outside dev mode. Before a bind, the
260
+ caller passes the host it will bind: if that bind succeeds, nothing holds
261
+ the port, so there is nothing to refuse and nothing to say.
262
+ """
263
+ if dev and not no_takeover:
264
+ return None
265
+ if host is not None and _bindable(host, port):
266
+ return TakeoverResult(NOTHING, port)
267
+ if no_takeover:
268
+ return TakeoverResult(
269
+ REFUSED_OPTOUT, port,
270
+ message=(f"Port {port} is in use and takeover is disabled "
271
+ f"(TINA4_NO_TAKEOVER/--no-kill) -- free it or choose another port."),
272
+ )
273
+ return TakeoverResult(
274
+ REFUSED_PROD, port,
275
+ message=(f"Port {port} is in use; takeover is disabled outside dev mode "
276
+ f"-- free it or choose another port."),
277
+ )
278
+
279
+
236
280
  # ── the ONE takeover entry point (CLI + runtime both call this) ────────────
237
281
 
238
282
  def take_over_port(
@@ -242,6 +286,7 @@ def take_over_port(
242
286
  no_takeover: bool,
243
287
  base_dir: str | None = None,
244
288
  grace: float = 0.5,
289
+ host: str | None = None,
245
290
  ) -> TakeoverResult:
246
291
  """Reclaim *port* ONLY from an identity-confirmed Tina4 dev server.
247
292
 
@@ -257,19 +302,15 @@ def take_over_port(
257
302
 
258
303
  ``dev`` and ``no_takeover`` are passed in so this stays pure and directly
259
304
  testable; the callers resolve them from :func:`is_dev` / :func:`no_takeover_opted_out`.
305
+
306
+ Before a bind, the caller passes the ``host`` it will bind. When takeover
307
+ would be refused and that bind succeeds, nothing holds the port: there is
308
+ nothing to refuse and nothing to say (NOTHING, no message). Without it, every
309
+ start with debug off or ``--no-kill`` said a free port was in use.
260
310
  """
261
- if no_takeover:
262
- return TakeoverResult(
263
- REFUSED_OPTOUT, port,
264
- message=(f"Port {port} is in use and takeover is disabled "
265
- f"(TINA4_NO_TAKEOVER/--no-kill) -- free it or choose another port."),
266
- )
267
- if not dev:
268
- return TakeoverResult(
269
- REFUSED_PROD, port,
270
- message=(f"Port {port} is in use; takeover is disabled outside dev mode "
271
- f"-- free it or choose another port."),
272
- )
311
+ early = _refusal(port, dev, no_takeover, host)
312
+ if early is not None:
313
+ return early
273
314
  if in_container():
274
315
  return TakeoverResult(SKIPPED_CONTAINER, port)
275
316
 
@@ -87,8 +87,12 @@ def get_framework_frond():
87
87
  # Sync custom filters/globals from the user engine
88
88
  if _framework_frond is not None:
89
89
  user_engine = get_frond()
90
- _framework_frond._filters.update(user_engine._filters)
91
- _framework_frond._globals.update(user_engine._globals)
90
+ # Instance filters only: class filters already reach every engine.
91
+ for name, fn in user_engine._local_filters.items():
92
+ _framework_frond.add_filter(name, fn)
93
+ # Only the user engine's own (instance) globals: class globals are
94
+ # already live on every engine, so copying them would freeze them.
95
+ _framework_frond._globals.maps[0].update(user_engine._globals.maps[0])
92
96
  return _framework_frond
93
97
 
94
98
 
@@ -670,9 +670,17 @@ def _auto_wire_i18n():
670
670
  default_locale=os.environ.get("TINA4_LOCALE", "en"),
671
671
  )
672
672
 
673
- # Only register if t() hasn't been explicitly set by the user
673
+ # Templates call t("key") or t("key", {"name": n}): Frond passes a
674
+ # params map positionally, and I18n.t takes keyword placeholders, so
675
+ # the template global accepts both shapes and merges them.
676
+ def _template_t(key, params=None, **kwargs):
677
+ return i18n.t(key, **{**(params or {}), **kwargs})
678
+
679
+ # Only register if t() hasn't been explicitly set by the user. A class
680
+ # registration reaches every engine, response.render's included,
681
+ # whenever it is made.
674
682
  if "t" not in Frond._class_globals:
675
- Frond._class_globals["t"] = i18n.t
683
+ Frond.add_global("t", _template_t)
676
684
  Log.info(f"i18n: auto-registered t() with {len(json_files)} locale(s)")
677
685
  except Exception as e:
678
686
  Log.error(f"i18n: auto-wire failed: {e}")
@@ -4239,6 +4247,15 @@ def _check_legacy_env_vars() -> None:
4239
4247
  sys.exit(2)
4240
4248
 
4241
4249
 
4250
+ _URL_USERINFO = re.compile(r"://[^/\s@]*@")
4251
+
4252
+
4253
+ def _strip_url_credentials(text: str) -> str:
4254
+ """``text`` with every URL's ``user:pass@`` removed - safe for a boot log."""
4255
+ from tina4_python.database.database_url import redact_url
4256
+ return _URL_USERINFO.sub("://", redact_url(text))
4257
+
4258
+
4242
4259
  def _auto_migrate_on_startup(migration_folder: str = "migrations") -> None:
4243
4260
  """Apply pending DB migrations on startup — NON-BREAKING.
4244
4261
 
@@ -4267,11 +4284,25 @@ def _auto_migrate_on_startup(migration_folder: str = "migrations") -> None:
4267
4284
  Log.debug("TINA4_AUTO_MIGRATE is off — skipping startup migrations")
4268
4285
  return
4269
4286
 
4287
+ configured_url = os.environ.get("TINA4_DATABASE_URL", "").strip()
4270
4288
  try:
4271
4289
  from tina4_python.database import Database
4272
4290
  db = Database() # resolves TINA4_DATABASE_URL (framework default if unset)
4273
4291
  except Exception as exc:
4274
- Log.debug(f"Startup migrations skipped (no database configured): {exc}")
4292
+ # Only an unset TINA4_DATABASE_URL is "no database configured". A set
4293
+ # but unreachable one must say so, or the operator chases a missing
4294
+ # setting that is in fact present (review of tina4-ruby#172).
4295
+ if configured_url:
4296
+ Log.debug(
4297
+ "Startup migrations skipped (database configured but could not "
4298
+ f"connect to {_strip_url_credentials(configured_url)}): "
4299
+ f"{_strip_url_credentials(str(exc))}"
4300
+ )
4301
+ else:
4302
+ Log.debug(
4303
+ "Startup migrations skipped (no database configured): "
4304
+ f"{_strip_url_credentials(str(exc))}"
4305
+ )
4275
4306
  return
4276
4307
 
4277
4308
  try:
@@ -742,6 +742,26 @@ def _peak_rss_mb() -> float:
742
742
  return round(peak / divisor, 2)
743
743
 
744
744
 
745
+ def _current_rss_mb() -> float:
746
+ """Current resident set size of this process, in MB.
747
+
748
+ From psutil when it is installed, else from ``VmRSS`` in
749
+ ``/proc/self/status`` (kilobytes; Linux and Android). Raises (OSError
750
+ where there is no /proc) when neither can be read, e.g. macOS or Windows
751
+ without psutil. Never the peak.
752
+ """
753
+ try:
754
+ import psutil # optional
755
+ return round(psutil.Process().memory_info().rss / 1024.0 / 1024.0, 2)
756
+ except Exception:
757
+ pass
758
+ with open("/proc/self/status") as fh:
759
+ for line in fh:
760
+ if line.startswith("VmRSS:"):
761
+ return round(int(line.split()[1]) / 1024.0, 2)
762
+ raise OSError("no VmRSS line in /proc/self/status")
763
+
764
+
745
765
  async def _api_status(request, response):
746
766
  """System status overview."""
747
767
  import sys
@@ -756,19 +776,17 @@ async def _api_status(request, response):
756
776
  db_table_count = len(db.get_tables())
757
777
  except Exception:
758
778
  pass
759
- # Memory telemetry — best-effort via resource (POSIX) or psutil if present;
760
- # falls back to 0.0 on Windows with no psutil so the key shape stays stable.
779
+ # Memory telemetry — peak via resource (POSIX), current via psutil or
780
+ # /proc. A figure that cannot be measured stays 0.0 so the key shape is
781
+ # stable; the peak is never reported as current usage.
761
782
  memory_usage_mb = 0.0
762
783
  peak_memory_mb = 0.0
763
784
  try:
764
785
  peak_memory_mb = _peak_rss_mb()
765
- memory_usage_mb = peak_memory_mb # resource has no current-rss field
766
786
  except Exception:
767
787
  pass
768
788
  try:
769
- import psutil # optional
770
- proc = psutil.Process()
771
- memory_usage_mb = round(proc.memory_info().rss / 1024.0 / 1024.0, 2)
789
+ memory_usage_mb = _current_rss_mb()
772
790
  except Exception:
773
791
  pass
774
792
 
@@ -1388,10 +1406,10 @@ async def _api_system(request, response):
1388
1406
  "database": redact_url(os.environ.get("TINA4_DATABASE_URL", "not configured")),
1389
1407
  }
1390
1408
 
1391
- # Memory info
1409
+ # Memory info — current RSS; None where it cannot be measured (never the peak)
1392
1410
  try:
1393
- info["memory_mb"] = _peak_rss_mb()
1394
- except (ImportError, AttributeError):
1411
+ info["memory_mb"] = _current_rss_mb()
1412
+ except Exception:
1395
1413
  info["memory_mb"] = None
1396
1414
 
1397
1415
  # Uptime
@@ -25,6 +25,7 @@ import json
25
25
  import math
26
26
  import secrets
27
27
  import time
28
+ from collections import ChainMap
28
29
  from functools import lru_cache
29
30
  from pathlib import Path
30
31
  from datetime import datetime, date
@@ -1969,9 +1970,14 @@ class Frond:
1969
1970
  # When a module creates ``frond = Frond()`` and a hot-reload
1970
1971
  # re-executes that line, the NEW instance inherits everything
1971
1972
  # previously registered via add_global / add_filter / add_test.
1973
+ # They are read from here at render time, so they also reach engines
1974
+ # that already exist (ADR-0106, ADR-0107).
1972
1975
  _class_globals: dict = {}
1973
1976
  _class_filters: dict = {}
1974
1977
  _class_tests: dict = {}
1978
+ # Bumped on every class-level filter/test change, so an engine knows when
1979
+ # to rebuild its merged filter/test maps (see _sync_registries).
1980
+ _class_registry_version: int = 0
1975
1981
  # Live blocks: name -> body template source (registered when a {% live %}
1976
1982
  # block renders); name -> data provider (registered via @live_source).
1977
1983
  _class_live_fragments: dict = {}
@@ -1988,15 +1994,18 @@ class Frond:
1988
1994
  cls._class_globals.clear()
1989
1995
  cls._class_filters.clear()
1990
1996
  cls._class_tests.clear()
1997
+ Frond._class_registry_version += 1
1991
1998
  cls._class_live_fragments.clear()
1992
1999
  cls._class_live_sources.clear()
1993
2000
  cls._class_live_ws_paths.clear()
1994
2001
 
1995
2002
  def __init__(self, template_dir: str = "src/templates"):
1996
2003
  self.template_dir = Path(template_dir)
1997
- self._filters = dict(_BUILTIN_FILTERS)
1998
- self._globals = {}
1999
- self._tests = {}
2004
+ # This engine's own add_filter / add_test calls (instance-local).
2005
+ self._local_filters: dict = {}
2006
+ self._local_tests: dict = {}
2007
+ self._registry_version = -1
2008
+ self._sync_registries() # builds self._filters / self._tests
2000
2009
  self._cache: dict[str, str] = {}
2001
2010
  # Sandboxing
2002
2011
  self._sandbox = False
@@ -2032,30 +2041,48 @@ class Frond:
2032
2041
  self._cache_ttl = 0
2033
2042
 
2034
2043
  # Built-in global functions
2035
- self._globals["form_token"] = _form_token
2036
- self._globals["formTokenValue"] = _form_token_value
2037
- self._globals["form_token_value"] = _form_token_value
2038
- self._globals["range"] = _frond_range
2044
+ builtin_globals = {
2045
+ "form_token": _form_token,
2046
+ "formTokenValue": _form_token_value,
2047
+ "form_token_value": _form_token_value,
2048
+ "range": _frond_range,
2049
+ }
2039
2050
 
2040
2051
  # Debug helper: {{ dump(x) }} — gated on TINA4_DEBUG=true.
2041
2052
  # Both this global and the |dump filter call _render_dump() which
2042
2053
  # returns an empty string in production so dump never leaks state.
2043
- self._globals["dump"] = _render_dump
2054
+ builtin_globals["dump"] = _render_dump
2044
2055
 
2045
2056
  # CSP nonce: {{ csp_nonce() }} returns the current response's nonce so a
2046
2057
  # template can serve an inline <style>/<script> under the strict default
2047
2058
  # Content-Security-Policy — <style nonce="{{ csp_nonce() }}">. The value
2048
2059
  # matches the 'nonce-X' the security middleware puts in the CSP header.
2049
2060
  from tina4_python.core.csp import csp_nonce as _csp_nonce
2050
- self._globals["csp_nonce"] = _csp_nonce
2051
-
2052
- # Restore any globals/filters/tests registered on prior instances.
2053
- # This is the key to surviving hot-reloads: app.py calls
2054
- # frond.add_global("t", _t) once, the class remembers it, and
2055
- # every future Frond() instance gets it automatically.
2056
- self._globals.update(Frond._class_globals)
2057
- self._filters.update(Frond._class_filters)
2058
- self._tests.update(Frond._class_tests)
2061
+ builtin_globals["csp_nonce"] = _csp_nonce
2062
+
2063
+ # Globals resolve in three layers, highest first: this instance's own
2064
+ # add_global calls, the class registry, the built-ins. The class layer
2065
+ # is the LIVE ``Frond._class_globals`` dict, not a copy, so a
2066
+ # ``Frond.add_global(...)`` made after this engine exists (after the
2067
+ # first ``response.render``, say) still reaches every template it
2068
+ # renders. Instance writes land in the first map only, so they stay
2069
+ # local to this engine (ADR-0052, ADR-0106).
2070
+ self._globals = ChainMap({}, Frond._class_globals, builtin_globals)
2071
+
2072
+ def _sync_registries(self) -> None:
2073
+ """Rebuild the merged filter/test maps when the class registry changed.
2074
+
2075
+ Same layering as globals -- built-ins < class < this instance -- so a
2076
+ ``Frond.add_filter`` / ``add_test`` made after this engine exists still
2077
+ reaches every template it renders (ADR-0107). Filter lookup is on the
2078
+ hot path, so the merge is a plain dict rebuilt only when the class
2079
+ registry version moves, never a per-lookup chain.
2080
+ """
2081
+ if self._registry_version == Frond._class_registry_version:
2082
+ return
2083
+ self._filters = {**_BUILTIN_FILTERS, **Frond._class_filters, **self._local_filters}
2084
+ self._tests = {**Frond._class_tests, **self._local_tests}
2085
+ self._registry_version = Frond._class_registry_version
2059
2086
 
2060
2087
  def sandbox(self, allowed_filters: list[str] = None,
2061
2088
  allowed_tags: list[str] = None,
@@ -2184,7 +2211,9 @@ class Frond:
2184
2211
  """
2185
2212
  if instance is None:
2186
2213
  cls._class_filters[name] = fn
2214
+ Frond._class_registry_version += 1
2187
2215
  else:
2216
+ instance._local_filters[name] = fn
2188
2217
  instance._filters[name] = fn
2189
2218
 
2190
2219
  @_ClassOrInstanceMethod
@@ -2209,12 +2238,24 @@ class Frond:
2209
2238
  """
2210
2239
  if instance is None:
2211
2240
  cls._class_tests[name] = fn
2241
+ Frond._class_registry_version += 1
2212
2242
  else:
2243
+ instance._local_tests[name] = fn
2213
2244
  instance._tests[name] = fn
2214
2245
 
2246
+ def _context(self, data: dict | None) -> dict:
2247
+ """Build a render context: built-ins < class globals < instance globals < data.
2248
+
2249
+ Every render starts here, so this is also where the filter/test maps
2250
+ catch up with any class registration made since the last render.
2251
+ """
2252
+ self._sync_registries()
2253
+ local_globals, class_globals, builtin_globals = self._globals.maps
2254
+ return {**builtin_globals, **class_globals, **local_globals, **(data or {})}
2255
+
2215
2256
  def render(self, template: str, data: dict = None) -> str:
2216
2257
  """Render a template with data. Uses token caching for performance."""
2217
- context = {**self._globals, **(data or {})}
2258
+ context = self._context(data)
2218
2259
 
2219
2260
  # Resolve file path and check mtime for cache validity
2220
2261
  path = self.template_dir / template
@@ -2257,7 +2298,7 @@ class Frond:
2257
2298
 
2258
2299
  def render_string(self, source: str, data: dict = None) -> str:
2259
2300
  """Render a template string directly. Uses token+AST caching."""
2260
- context = {**self._globals, **(data or {})}
2301
+ context = self._context(data)
2261
2302
 
2262
2303
  key = hashlib.md5(source.encode()).hexdigest()
2263
2304
  cached = self._compiled_strings.get(key)
File without changes
File without changes