splent-framework 1.18.2__tar.gz → 1.19.0__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 (190) hide show
  1. {splent_framework-1.18.2/src/splent_framework.egg-info → splent_framework-1.19.0}/PKG-INFO +1 -1
  2. {splent_framework-1.18.2 → splent_framework-1.19.0}/pyproject.toml +1 -1
  3. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/configuration/configuration.py +16 -1
  4. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/decorators/decorators.py +15 -3
  5. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/utils/path_utils.py +24 -0
  6. {splent_framework-1.18.2 → splent_framework-1.19.0/src/splent_framework.egg-info}/PKG-INFO +1 -1
  7. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework.egg-info/SOURCES.txt +3 -0
  8. splent_framework-1.19.0/tests/test_app_version.py +46 -0
  9. splent_framework-1.19.0/tests/test_has_role.py +88 -0
  10. splent_framework-1.19.0/tests/test_protected_uploads_dir.py +56 -0
  11. {splent_framework-1.18.2 → splent_framework-1.19.0}/COPYING +0 -0
  12. {splent_framework-1.18.2 → splent_framework-1.19.0}/COPYING.LESSER +0 -0
  13. {splent_framework-1.18.2 → splent_framework-1.19.0}/README.md +0 -0
  14. {splent_framework-1.18.2 → splent_framework-1.19.0}/setup.cfg +0 -0
  15. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/__init__.py +0 -0
  16. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/admin/__init__.py +0 -0
  17. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/admin/registry.py +0 -0
  18. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/app_factory.py +0 -0
  19. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/assets/__init__.py +0 -0
  20. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/assets/asset_registry.py +0 -0
  21. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/blueprints/__init__.py +0 -0
  22. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/blueprints/base_blueprint.py +0 -0
  23. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/bootstraps/__init__.py +0 -0
  24. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/bootstraps/locustfile_bootstrap.py +0 -0
  25. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/configuration/__init__.py +0 -0
  26. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/configuration/default_config.py +0 -0
  27. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/context/__init__.py +0 -0
  28. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/context/context_manager.py +0 -0
  29. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/db.py +0 -0
  30. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/decorators/__init__.py +0 -0
  31. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/environment/__init__.py +0 -0
  32. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/environment/host.py +0 -0
  33. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/fixtures/__init__.py +0 -0
  34. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/fixtures/fixtures.py +0 -0
  35. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/helpers/__init__.py +0 -0
  36. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/helpers/test_helpers_auth.py +0 -0
  37. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/hooks/__init__.py +0 -0
  38. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/hooks/template_hooks.py +0 -0
  39. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/i18n/__init__.py +0 -0
  40. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/i18n/text.py +0 -0
  41. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/locust/__init__.py +0 -0
  42. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/locust/common.py +0 -0
  43. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/__init__.py +0 -0
  44. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/config_manager.py +0 -0
  45. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/cookie_security_manager.py +0 -0
  46. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/csrf_manager.py +0 -0
  47. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/db_manager.py +0 -0
  48. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/error_handler_manager.py +0 -0
  49. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/feature_loader.py +0 -0
  50. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/feature_manager.py +0 -0
  51. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/feature_order.py +0 -0
  52. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/jinja_manager.py +0 -0
  53. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/locale_manager.py +0 -0
  54. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/logging_manager.py +0 -0
  55. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/migration_manager.py +0 -0
  56. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/namespace_manager.py +0 -0
  57. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/proxy_manager.py +0 -0
  58. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/security_headers_manager.py +0 -0
  59. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/session_manager.py +0 -0
  60. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/managers/static_cache_manager.py +0 -0
  61. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/markdown/__init__.py +0 -0
  62. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/markdown/render.py +0 -0
  63. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/migrations/__init__.py +0 -0
  64. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/migrations/feature_env.py +0 -0
  65. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/namespaces/__init__.py +0 -0
  66. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/nav/__init__.py +0 -0
  67. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/nav/nav_registry.py +0 -0
  68. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/refinement/__init__.py +0 -0
  69. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/refinement/conflicts.py +0 -0
  70. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/refinement/facts.py +0 -0
  71. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/refinement/model_extender.py +0 -0
  72. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/refinement/parser.py +0 -0
  73. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/refinement/registry.py +0 -0
  74. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/refinement/templates.py +0 -0
  75. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/refinement/validator.py +0 -0
  76. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/repositories/BaseRepository.py +0 -0
  77. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/repositories/__init__.py +0 -0
  78. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/search/__init__.py +0 -0
  79. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/search/search_registry.py +0 -0
  80. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/seeders/BaseSeeder.py +0 -0
  81. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/seeders/__init__.py +0 -0
  82. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/selenium/__init__.py +0 -0
  83. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/selenium/common.py +0 -0
  84. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/services/BaseService.py +0 -0
  85. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/services/__init__.py +0 -0
  86. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/services/file_access.py +0 -0
  87. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/services/service_locator.py +0 -0
  88. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/settings/__init__.py +0 -0
  89. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/settings/settings_schema.py +0 -0
  90. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/signals/__init__.py +0 -0
  91. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/signals/registry.py +0 -0
  92. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/signals/signal_utils.py +0 -0
  93. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/translations/es/LC_MESSAGES/messages.mo +0 -0
  94. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/translations/es/LC_MESSAGES/messages.po +0 -0
  95. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/translations/messages.pot +0 -0
  96. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/utils/__init__.py +0 -0
  97. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/utils/app_loader.py +0 -0
  98. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/utils/feature_utils.py +0 -0
  99. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/utils/form_helpers.py +0 -0
  100. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/utils/pyproject_reader.py +0 -0
  101. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/utils/text.py +0 -0
  102. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework/utils/uvl_resolver.py +0 -0
  103. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework.egg-info/dependency_links.txt +0 -0
  104. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework.egg-info/requires.txt +0 -0
  105. {splent_framework-1.18.2 → splent_framework-1.19.0}/src/splent_framework.egg-info/top_level.txt +0 -0
  106. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_base_blueprint_security.py +0 -0
  107. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_base_repository.py +0 -0
  108. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_config_manager.py +0 -0
  109. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_config_manager_return.py +0 -0
  110. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_config_trace.py +0 -0
  111. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_context_manager.py +0 -0
  112. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_csrf.py +0 -0
  113. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_default_config.py +0 -0
  114. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_error_handler_manager.py +0 -0
  115. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_feature_loader_imports.py +0 -0
  116. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_feature_manager_parse.py +0 -0
  117. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_feature_order.py +0 -0
  118. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_feature_utils.py +0 -0
  119. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_helpers_host.py +0 -0
  120. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_helpers_locust.py +0 -0
  121. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_helpers_selenium.py +0 -0
  122. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_i18n_text.py +0 -0
  123. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_locale_manager.py +0 -0
  124. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_locustfile_bootstrap.py +0 -0
  125. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_markdown.py +0 -0
  126. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_migration_manager.py +0 -0
  127. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_namespace_manager.py +0 -0
  128. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_path_utils_env_file.py +0 -0
  129. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_prod_cookies.py +0 -0
  130. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_prod_db_engine_options.py +0 -0
  131. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_prod_factory_integration.py +0 -0
  132. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_prod_max_content_length.py +0 -0
  133. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_prod_operator_settings.py +0 -0
  134. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_prod_security_headers.py +0 -0
  135. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_prod_static_cache.py +0 -0
  136. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_proxy_manager.py +0 -0
  137. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_pyproject_reader.py +0 -0
  138. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_pyproject_reader_env.py +0 -0
  139. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_refinement.py +0 -0
  140. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_refinement_boot.py +0 -0
  141. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_refinement_conflicts.py +0 -0
  142. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_refinement_hooks.py +0 -0
  143. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_refinement_load_order.py +0 -0
  144. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_refinement_models.py +0 -0
  145. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_refinement_routes.py +0 -0
  146. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_refinement_services.py +0 -0
  147. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_refinement_templates.py +0 -0
  148. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_search_registry.py +0 -0
  149. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_settings_schema.py +0 -0
  150. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_text.py +0 -0
  151. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u1_app_factory.py +0 -0
  152. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u1_config_manager.py +0 -0
  153. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u1_csrf.py +0 -0
  154. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u1_error_handlers.py +0 -0
  155. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u1_error_page_fails.py +0 -0
  156. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u1_forbidden_page.py +0 -0
  157. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u1_logging_manager.py +0 -0
  158. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u2_app_loader.py +0 -0
  159. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u2_path_utils.py +0 -0
  160. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u2_session_manager.py +0 -0
  161. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u3_feature_integrator.py +0 -0
  162. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u3_feature_link_resolver.py +0 -0
  163. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u3_feature_loader.py +0 -0
  164. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u3_feature_sources_override.py +0 -0
  165. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u3_refiner_extensions.py +0 -0
  166. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u4_contracts_snapshot.py +0 -0
  167. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u4_feature_lists.py +0 -0
  168. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u4_feature_manager.py +0 -0
  169. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u5_asset_registry.py +0 -0
  170. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u5_base_blueprint.py +0 -0
  171. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u5_namespace_manager.py +0 -0
  172. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u6_admin_registry.py +0 -0
  173. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u6_jinja_manager.py +0 -0
  174. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u6_markdown.py +0 -0
  175. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u6_nav_registry.py +0 -0
  176. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u6_template_hooks.py +0 -0
  177. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u7_i18n_text.py +0 -0
  178. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u7_locale_manager.py +0 -0
  179. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u7_settings_schema.py +0 -0
  180. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u8_feature_env.py +0 -0
  181. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u8_file_access.py +0 -0
  182. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u8_migration_logging.py +0 -0
  183. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u8_model_extender.py +0 -0
  184. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u8_service_refinement.py +0 -0
  185. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u8_signals.py +0 -0
  186. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u9_base_repository.py +0 -0
  187. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u9_base_seeder.py +0 -0
  188. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u9_file_access.py +0 -0
  189. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_u9_form_helpers.py +0 -0
  190. {splent_framework-1.18.2 → splent_framework-1.19.0}/tests/test_uvl_resolver.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splent_framework
3
- Version: 1.18.2
3
+ Version: 1.19.0
4
4
  Summary: SPLENT-FRAMEWORK is a set of libraries for agile product development within SPLENT.
5
5
  Author-email: DiversoLab <diversolab@us.es>
6
6
  License-Expression: LGPL-3.0-or-later
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "splent_framework"
7
- version = "1.18.2"
7
+ version = "1.19.0"
8
8
  description = "SPLENT-FRAMEWORK is a set of libraries for agile product development within SPLENT."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.13"
@@ -1,4 +1,6 @@
1
1
  import os
2
+ from importlib import metadata
3
+
2
4
  from dotenv import load_dotenv
3
5
 
4
6
  load_dotenv()
@@ -9,12 +11,25 @@ def uploads_folder_name():
9
11
 
10
12
 
11
13
  def get_app_version():
14
+ """The running product's version.
15
+
16
+ A ``.version`` file in WORKING_DIR wins, so a deployment can stamp its own
17
+ tag. Otherwise it is the version of the installed product package, which
18
+ product:release bumps and every image installs.
19
+ """
12
20
  version_file_path = os.path.join(os.getenv("WORKING_DIR", ""), ".version")
13
21
  try:
14
22
  with open(version_file_path) as file:
15
23
  return file.readline().strip()
16
24
  except FileNotFoundError:
17
- return "unknown"
25
+ pass
26
+ product = os.getenv("SPLENT_APP")
27
+ if product:
28
+ try:
29
+ return metadata.version(product)
30
+ except metadata.PackageNotFoundError:
31
+ pass
32
+ return "unknown"
18
33
 
19
34
 
20
35
  def is_develop():
@@ -17,6 +17,20 @@ def pass_or_abort(condition):
17
17
  return decorator
18
18
 
19
19
 
20
+ def has_role(*roles) -> bool:
21
+ """Whether the signed-in account is active and its ``role`` is in ``roles``.
22
+
23
+ The question role_required asks, for the places that must not offer a
24
+ door it would refuse: a sidebar link or a button shown to an account the
25
+ page then answers with 403.
26
+ """
27
+ return bool(
28
+ getattr(current_user, "is_authenticated", False)
29
+ and getattr(current_user, "active", False)
30
+ and getattr(current_user, "role", None) in roles
31
+ )
32
+
33
+
20
34
  def role_required(*roles):
21
35
  """Require an authenticated, active user whose ``role`` is in ``roles``.
22
36
 
@@ -37,9 +51,7 @@ def role_required(*roles):
37
51
  @login_required
38
52
  @wraps(f)
39
53
  def wrapper(*args, **kwargs):
40
- if not getattr(current_user, "active", False):
41
- abort(403)
42
- if getattr(current_user, "role", None) not in roles:
54
+ if not has_role(*roles):
43
55
  abort(403)
44
56
  return f(*args, **kwargs)
45
57
 
@@ -11,6 +11,30 @@ def is_splent_dev_mode():
11
11
  return os.getenv("SPLENT", "false").lower() in ("true", "1", "yes")
12
12
 
13
13
 
14
+ def protected_uploads_dir() -> str:
15
+ """The product's directory for files the app serves behind an access check.
16
+
17
+ PROTECTED_UPLOADS_DIR, which the production compose mounts as a named
18
+ volume so its contents survive redeploys, and otherwise the app's
19
+ instance/protected_uploads. Resolve only: creating it here would let an
20
+ unmounted volume look like an empty directory, so writers create the
21
+ folder they write to.
22
+ """
23
+ from flask import current_app, has_app_context
24
+
25
+ configured = has_app_context() and current_app.config.get("PROTECTED_UPLOADS_DIR")
26
+ if configured:
27
+ return configured
28
+ if os.getenv("PROTECTED_UPLOADS_DIR"):
29
+ return os.environ["PROTECTED_UPLOADS_DIR"]
30
+ if has_app_context():
31
+ return os.path.join(current_app.instance_path, "protected_uploads")
32
+ raise RuntimeError(
33
+ "PROTECTED_UPLOADS_DIR is not set and there is no app to take the "
34
+ "instance folder from."
35
+ )
36
+
37
+
14
38
  class PathUtils:
15
39
  @staticmethod
16
40
  def get_working_dir():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splent_framework
3
- Version: 1.18.2
3
+ Version: 1.19.0
4
4
  Summary: SPLENT-FRAMEWORK is a set of libraries for agile product development within SPLENT.
5
5
  Author-email: DiversoLab <diversolab@us.es>
6
6
  License-Expression: LGPL-3.0-or-later
@@ -98,6 +98,7 @@ src/splent_framework/utils/path_utils.py
98
98
  src/splent_framework/utils/pyproject_reader.py
99
99
  src/splent_framework/utils/text.py
100
100
  src/splent_framework/utils/uvl_resolver.py
101
+ tests/test_app_version.py
101
102
  tests/test_base_blueprint_security.py
102
103
  tests/test_base_repository.py
103
104
  tests/test_config_manager.py
@@ -111,6 +112,7 @@ tests/test_feature_loader_imports.py
111
112
  tests/test_feature_manager_parse.py
112
113
  tests/test_feature_order.py
113
114
  tests/test_feature_utils.py
115
+ tests/test_has_role.py
114
116
  tests/test_helpers_host.py
115
117
  tests/test_helpers_locust.py
116
118
  tests/test_helpers_selenium.py
@@ -128,6 +130,7 @@ tests/test_prod_max_content_length.py
128
130
  tests/test_prod_operator_settings.py
129
131
  tests/test_prod_security_headers.py
130
132
  tests/test_prod_static_cache.py
133
+ tests/test_protected_uploads_dir.py
131
134
  tests/test_proxy_manager.py
132
135
  tests/test_pyproject_reader.py
133
136
  tests/test_pyproject_reader_env.py
@@ -0,0 +1,46 @@
1
+ """
2
+ Tests for splent_framework.configuration.configuration.get_app_version
3
+
4
+ Covers:
5
+ - A .version file in WORKING_DIR wins
6
+ - Without it, the version of the installed product package (SPLENT_APP)
7
+ - Without either, "unknown"
8
+ """
9
+
10
+ from importlib import metadata
11
+
12
+ from splent_framework.configuration import configuration
13
+ from splent_framework.configuration.configuration import get_app_version
14
+
15
+
16
+ class TestGetAppVersion:
17
+ def test_version_file_wins(self, tmp_path, monkeypatch):
18
+ (tmp_path / ".version").write_text("v2.4.0\n")
19
+ monkeypatch.setenv("WORKING_DIR", str(tmp_path))
20
+ monkeypatch.setenv("SPLENT_APP", "splent_framework")
21
+ assert get_app_version() == "v2.4.0"
22
+
23
+ def test_falls_back_to_the_installed_product_package(self, tmp_path, monkeypatch):
24
+ monkeypatch.setenv("WORKING_DIR", str(tmp_path))
25
+ monkeypatch.setenv("SPLENT_APP", "my_product")
26
+ monkeypatch.setattr(
27
+ configuration.metadata,
28
+ "version",
29
+ lambda name: "1.3.0" if name == "my_product" else None,
30
+ )
31
+ assert get_app_version() == "1.3.0"
32
+
33
+ def test_unknown_when_the_product_is_not_installed(self, tmp_path, monkeypatch):
34
+ monkeypatch.setenv("WORKING_DIR", str(tmp_path))
35
+ monkeypatch.setenv("SPLENT_APP", "not_an_installed_product")
36
+
37
+ def missing(name):
38
+ raise metadata.PackageNotFoundError(name)
39
+
40
+ monkeypatch.setattr(configuration.metadata, "version", missing)
41
+ assert get_app_version() == "unknown"
42
+
43
+ def test_unknown_without_a_product(self, tmp_path, monkeypatch):
44
+ monkeypatch.setenv("WORKING_DIR", str(tmp_path))
45
+ monkeypatch.delenv("SPLENT_APP", raising=False)
46
+ assert get_app_version() == "unknown"
@@ -0,0 +1,88 @@
1
+ """
2
+ Tests for splent_framework.decorators.decorators.has_role and role_required
3
+
4
+ Covers:
5
+ - has_role answers the question role_required asks: signed in, active and
6
+ with one of the roles
7
+ - role_required lets the right account in and answers 403 to the rest
8
+ """
9
+
10
+ from types import SimpleNamespace
11
+
12
+ import pytest
13
+ from flask import Flask
14
+ from flask_login import LoginManager, login_user
15
+
16
+ from splent_framework.decorators.decorators import has_role, role_required
17
+
18
+
19
+ class _Account(SimpleNamespace):
20
+ is_authenticated = True
21
+ is_anonymous = False
22
+
23
+ @property
24
+ def is_active(self):
25
+ return getattr(self, "active", False)
26
+
27
+ def get_id(self):
28
+ return str(self.id)
29
+
30
+
31
+ ACCOUNTS = {
32
+ "1": _Account(id=1, active=True, role="admin"),
33
+ "2": _Account(id=2, active=True, role="user"),
34
+ "3": _Account(id=3, active=False, role="admin"),
35
+ "4": _Account(id=4, active=True),
36
+ }
37
+
38
+
39
+ @pytest.fixture
40
+ def app():
41
+ app = Flask(__name__)
42
+ app.config.update(SECRET_KEY="test", TESTING=True)
43
+ manager = LoginManager(app)
44
+ manager.user_loader(ACCOUNTS.get)
45
+
46
+ @app.route("/admin")
47
+ @role_required("admin")
48
+ def admin():
49
+ return "panel"
50
+
51
+ @app.route("/as/<account_id>")
52
+ def sign_in(account_id):
53
+ login_user(ACCOUNTS[account_id], force=True)
54
+ return "ok"
55
+
56
+ return app
57
+
58
+
59
+ class TestHasRole:
60
+ @pytest.mark.parametrize(
61
+ "account_id, expected", [("1", True), ("2", False), ("3", False), ("4", False)]
62
+ )
63
+ def test_active_account_with_the_role(self, app, account_id, expected):
64
+ with app.test_request_context():
65
+ login_user(ACCOUNTS[account_id], force=True)
66
+ assert has_role("admin") is expected
67
+
68
+ def test_anonymous_has_no_role(self, app):
69
+ with app.test_request_context():
70
+ assert has_role("admin") is False
71
+
72
+ def test_any_of_several_roles(self, app):
73
+ with app.test_request_context():
74
+ login_user(ACCOUNTS["2"], force=True)
75
+ assert has_role("staff", "user") is True
76
+
77
+
78
+ class TestRoleRequired:
79
+ def test_the_admin_gets_in(self, app):
80
+ client = app.test_client()
81
+ client.get("/as/1")
82
+ assert client.get("/admin").data == b"panel"
83
+
84
+ @pytest.mark.parametrize("account_id", ["2", "3", "4"])
85
+ def test_the_rest_get_403(self, app, account_id):
86
+ client = app.test_client()
87
+ client.get(f"/as/{account_id}")
88
+ assert client.get("/admin").status_code == 403
@@ -0,0 +1,56 @@
1
+ """
2
+ Tests for splent_framework.utils.path_utils.protected_uploads_dir
3
+
4
+ Covers:
5
+ - The app's PROTECTED_UPLOADS_DIR wins
6
+ - Then the environment variable, also without an app
7
+ - Then the app's instance/protected_uploads
8
+ - Without either an app or the variable, a clear error
9
+ """
10
+
11
+ import os
12
+
13
+ import pytest
14
+ from flask import Flask
15
+
16
+ from splent_framework.utils.path_utils import protected_uploads_dir
17
+
18
+
19
+ @pytest.fixture
20
+ def app(tmp_path):
21
+ return Flask("protected_uploads_test", instance_path=str(tmp_path / "instance"))
22
+
23
+
24
+ class TestProtectedUploadsDir:
25
+ def test_the_app_config_wins(self, app, monkeypatch):
26
+ monkeypatch.setenv("PROTECTED_UPLOADS_DIR", "/from/env")
27
+ app.config["PROTECTED_UPLOADS_DIR"] = "/from/config"
28
+ with app.app_context():
29
+ assert protected_uploads_dir() == "/from/config"
30
+
31
+ def test_the_environment_variable_without_config(self, app, monkeypatch):
32
+ monkeypatch.setenv("PROTECTED_UPLOADS_DIR", "/from/env")
33
+ app.config["PROTECTED_UPLOADS_DIR"] = ""
34
+ with app.app_context():
35
+ assert protected_uploads_dir() == "/from/env"
36
+
37
+ def test_the_environment_variable_without_an_app(self, monkeypatch):
38
+ monkeypatch.setenv("PROTECTED_UPLOADS_DIR", "/from/env")
39
+ assert protected_uploads_dir() == "/from/env"
40
+
41
+ def test_the_instance_folder_otherwise(self, app, monkeypatch):
42
+ monkeypatch.delenv("PROTECTED_UPLOADS_DIR", raising=False)
43
+ with app.app_context():
44
+ assert protected_uploads_dir() == os.path.join(
45
+ app.instance_path, "protected_uploads"
46
+ )
47
+
48
+ def test_it_does_not_create_the_folder(self, app, monkeypatch):
49
+ monkeypatch.delenv("PROTECTED_UPLOADS_DIR", raising=False)
50
+ with app.app_context():
51
+ assert not os.path.exists(protected_uploads_dir())
52
+
53
+ def test_an_error_without_app_or_variable(self, monkeypatch):
54
+ monkeypatch.delenv("PROTECTED_UPLOADS_DIR", raising=False)
55
+ with pytest.raises(RuntimeError, match="PROTECTED_UPLOADS_DIR"):
56
+ protected_uploads_dir()