bustapi 0.13.4__tar.gz → 0.13.6__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.
- {bustapi-0.13.4 → bustapi-0.13.6}/CHANGELOG.md +15 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/Cargo.lock +27 -28
- {bustapi-0.13.4 → bustapi-0.13.6}/Cargo.toml +1 -1
- {bustapi-0.13.4 → bustapi-0.13.6}/PKG-INFO +1 -1
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/changelog.md +15 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/pyproject.toml +1 -1
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/__init__.py +1 -1
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/app.py +9 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/auth/login.py +2 -2
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/context.py +5 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/core/helpers.py +26 -3
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/dispatch.py +18 -0
- bustapi-0.13.6/tests/test_issue_24.py +88 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/- +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/.github/FUNDING.yml +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/.github/workflows/ci-multiplatform.yml +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/.github/workflows/ci.yml +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/.github/workflows/docs.yml +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/.github/workflows/manual-publish.yml +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/.gitignore +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/.python-version +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/AGENT_KNOWLEDGE.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/Dockerfile +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/LICENSE +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/README.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/CACHE_BENCHMARK.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/README.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/app.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/benchmark_all.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/benchmark_avg.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/benchmark_cache.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/benchmark_combined.png +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/bustapi.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/bustapi_bench.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/bustapi_internal.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/comparison_bench.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/comprehensive_benchmark.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/gen_graph.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/quick_bench.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/resource_bench.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/rps_comparison.png +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/run_comparison_auto.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/benchmarks/ws_benchmark.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/advanced/async.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/advanced/blueprints.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/advanced/dependency_injection.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/advanced/deployment.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/advanced/middleware.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/advanced/security.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/advanced/validation.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/api-reference.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/assets/logo.png +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/complete-api-reference.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/deployment-performance-guide.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/deployment.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/examples-guide.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/index.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/installation.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/overrides/.gitkeep +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/quickstart.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/release_track.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/advanced/async_support.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/advanced/blueprints.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/advanced/dependency_injection.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/advanced/middleware.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/advanced/validation.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/api/all.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/api/app.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/api/context.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/api/utilities.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/assets/logo.png +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/changelog.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/core_concepts/request_data.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/core_concepts/responses.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/core_concepts/routing.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/core_concepts/templates.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/examples/index.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/getting_started/index.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/getting_started/quickstart.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/index.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/script.js +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/site/style.css +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/stylesheets/extra.css +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/authentication.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/caching.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/cli.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/database.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/documentation.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/error_handling.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/jwt.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/logging.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/multiprocessing.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/request_data.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/responses.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/routing.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/sessions.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/static_files.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/templates.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/turbo-routes.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/user-guide/video-streaming.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/docs/websockets.md +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/advanced/08_auto_docs.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/advanced/12_test_modes.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/advanced/13_error_handling.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/advanced/14_middleware.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/advanced/16_middleware_session.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/advanced/20_file_uploads.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/advanced/24_body_and_depends.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/advanced/27_video_stream.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/advanced/28_websocket.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/advanced/29_turbo_websocket.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/basics/01_hello_world.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/basics/02_parameters.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/basics/03_async.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/basics/04_request_data.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/basics/19_all_types.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/database/07_database_raw.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/database/10_database_sqlmodel.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/routing/06_blueprints.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/routing/09_complex_routing.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/routing/21_path_validation.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/routing/22_path_docs.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/routing/23_query_validation.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/routing/blueprint_with_jwt.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/security/10_rate_limit_demo.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/security/11_security_demo.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/security/17_jwt_auth.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/security/17_safe_features.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/security/18_jwt_cookies.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/security/18_safe_advanced.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/security/18_session_login.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/templates/05_templates.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/templates/26_complex_template.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/templates/templates/index.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/turbo/cache_test.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/turbo/fair_benchmark.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/turbo/typed_turbo_example.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/ws/app.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/ws/templates/index.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/ws/websockets_demo.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/examples/ws/ws_limit.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/mkdocs.yml +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/auth/__init__.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/auth/csrf.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/auth/decorators.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/auth/password.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/auth/tokens.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/auth/user.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/cli/__init__.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/cli/main.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/core/__init__.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/core/asgi.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/core/exceptions.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/core/logging.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/dependencies.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/documentation/__init__.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/documentation/generator.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/extraction.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/fastapi_compat.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/hooks.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/http/__init__.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/http/request.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/http/response.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/jwt.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/logging.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/middleware.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/multiprocess.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/params.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/py.typed +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/responses.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/routing/__init__.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/routing/blueprints.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/routing/decorators.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/safe/__init__.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/safe/concurrency.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/safe/types.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/security/__init__.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/security/extension.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/security/rate_limit.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/server/__init__.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/server/runner.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/server/wsgi.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/sessions.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/templating/__init__.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/templating/engine.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/templating/mixin.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/testing/__init__.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/testing/client.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/utils.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/python/bustapi/websocket.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/run_all_examples.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/scratch/test_abort.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/scratch/test_headers.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/bindings/app.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/bindings/converters.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/bindings/handlers.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/bindings/mod.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/bindings/request.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/bindings/typed_turbo.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/bindings/websocket.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/crypto.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/jwt.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/lib.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/logger.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/rate_limiter.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/request/methods.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/request/mod.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/request/tests.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/response/builders.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/response/methods.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/response/mod.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/router/handlers.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/router/matching.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/router/middleware.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/router/mod.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/router/tests.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/server/handlers.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/server/mod.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/server/startup.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/server/stream.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/static_files.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/templating.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/watcher.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/websocket/config.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/websocket/mod.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/websocket/session.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/src/websocket/turbo.rs +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/static/style.css +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/templates/base.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/templates/complex.html +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/docs_test_all.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/docs_test_api_reference.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/docs_test_installation.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/docs_test_quickstart.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/docs_test_simple.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_050_features.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_async_hooks.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_async_login.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_auth.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_discussion_21.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_discussion_22.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_examples.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_hot_reload.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_issue_18.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_issue_23.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_jwt.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_jwt_cookies.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_login_manager.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_middleware.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_multiprocess_stability.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_new_examples.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_orm_conflict.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_path_standalone.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_path_validation.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_rate_limit_rust.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_safe.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_security_unit.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_sessions.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/test_zero_copy.py +0 -0
- {bustapi-0.13.4 → bustapi-0.13.6}/tests/verify_router.py +0 -0
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented here.
|
|
4
4
|
|
|
5
|
+
## [0.13.6] - 2026-06-08
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **Auth Login Context**: Fixed `login_manager` extraction by correcting the attribute check on the request from `_app` to `app` ([#26](https://github.com/RUSTxPY/BustAPI/issues/26)).
|
|
9
|
+
- **Template Directory Handling**: Resolved duplicated fallback logic for template directories in `core/helpers.py` by streamlining the lookup against `current_app.template_folder` ([#25](https://github.com/RUSTxPY/BustAPI/issues/25)).
|
|
10
|
+
|
|
11
|
+
## [0.13.5] - 2026-06-04
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **Context Processor Tests**: Added comprehensive test cases (`test_issue_24.py`) to verify application-wide and blueprint-specific template context processors and CSRFProtect initialization.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- **CSRFProtect AttributeError**: Fixed an issue where initializing `CSRFProtect(app)` raised an `AttributeError` by implementing the `context_processor` decorator on the `BustAPI` application object.
|
|
18
|
+
- **Request Endpoint Resolution**: Mapped the active endpoint (`request.endpoint`) during route dispatch so that blueprint-specific context processors can be resolved and applied during template rendering.
|
|
19
|
+
|
|
5
20
|
## [0.13.4] - 2026-06-02
|
|
6
21
|
|
|
7
22
|
### Added
|
|
@@ -372,9 +372,9 @@ checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
|
|
|
372
372
|
|
|
373
373
|
[[package]]
|
|
374
374
|
name = "bitflags"
|
|
375
|
-
version = "2.
|
|
375
|
+
version = "2.13.0"
|
|
376
376
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
377
|
-
checksum = "
|
|
377
|
+
checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
|
|
378
378
|
|
|
379
379
|
[[package]]
|
|
380
380
|
name = "blake2"
|
|
@@ -432,7 +432,7 @@ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
|
|
|
432
432
|
|
|
433
433
|
[[package]]
|
|
434
434
|
name = "bustapi_core"
|
|
435
|
-
version = "0.13.
|
|
435
|
+
version = "0.13.6"
|
|
436
436
|
dependencies = [
|
|
437
437
|
"actix-files",
|
|
438
438
|
"actix-http",
|
|
@@ -526,9 +526,9 @@ dependencies = [
|
|
|
526
526
|
|
|
527
527
|
[[package]]
|
|
528
528
|
name = "chrono"
|
|
529
|
-
version = "0.4.
|
|
529
|
+
version = "0.4.45"
|
|
530
530
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
531
|
-
checksum = "
|
|
531
|
+
checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
|
|
532
532
|
dependencies = [
|
|
533
533
|
"iana-time-zone",
|
|
534
534
|
"js-sys",
|
|
@@ -1329,13 +1329,12 @@ dependencies = [
|
|
|
1329
1329
|
|
|
1330
1330
|
[[package]]
|
|
1331
1331
|
name = "js-sys"
|
|
1332
|
-
version = "0.3.
|
|
1332
|
+
version = "0.3.100"
|
|
1333
1333
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1334
|
-
checksum = "
|
|
1334
|
+
checksum = "f2025f20d7a4fa7785846e7b63d10a76d3f1cee98ee5cb79ea59703f95e42162"
|
|
1335
1335
|
dependencies = [
|
|
1336
1336
|
"cfg-if",
|
|
1337
1337
|
"futures-util",
|
|
1338
|
-
"once_cell",
|
|
1339
1338
|
"wasm-bindgen",
|
|
1340
1339
|
]
|
|
1341
1340
|
|
|
@@ -1432,9 +1431,9 @@ dependencies = [
|
|
|
1432
1431
|
|
|
1433
1432
|
[[package]]
|
|
1434
1433
|
name = "log"
|
|
1435
|
-
version = "0.4.
|
|
1434
|
+
version = "0.4.32"
|
|
1436
1435
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1437
|
-
checksum = "
|
|
1436
|
+
checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a"
|
|
1438
1437
|
|
|
1439
1438
|
[[package]]
|
|
1440
1439
|
name = "matchers"
|
|
@@ -1876,9 +1875,9 @@ dependencies = [
|
|
|
1876
1875
|
|
|
1877
1876
|
[[package]]
|
|
1878
1877
|
name = "regex"
|
|
1879
|
-
version = "1.12.
|
|
1878
|
+
version = "1.12.4"
|
|
1880
1879
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1881
|
-
checksum = "
|
|
1880
|
+
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
|
|
1882
1881
|
dependencies = [
|
|
1883
1882
|
"aho-corasick",
|
|
1884
1883
|
"memchr",
|
|
@@ -1905,9 +1904,9 @@ checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973"
|
|
|
1905
1904
|
|
|
1906
1905
|
[[package]]
|
|
1907
1906
|
name = "regex-syntax"
|
|
1908
|
-
version = "0.8.
|
|
1907
|
+
version = "0.8.11"
|
|
1909
1908
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1910
|
-
checksum = "
|
|
1909
|
+
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|
1911
1910
|
|
|
1912
1911
|
[[package]]
|
|
1913
1912
|
name = "rustc_version"
|
|
@@ -2457,9 +2456,9 @@ dependencies = [
|
|
|
2457
2456
|
|
|
2458
2457
|
[[package]]
|
|
2459
2458
|
name = "wasm-bindgen"
|
|
2460
|
-
version = "0.2.
|
|
2459
|
+
version = "0.2.123"
|
|
2461
2460
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2462
|
-
checksum = "
|
|
2461
|
+
checksum = "a254a4b10c19a76f09a27640e7ffbf9bc30bf67e16a3bf28aaefa4920fe81563"
|
|
2463
2462
|
dependencies = [
|
|
2464
2463
|
"cfg-if",
|
|
2465
2464
|
"once_cell",
|
|
@@ -2470,9 +2469,9 @@ dependencies = [
|
|
|
2470
2469
|
|
|
2471
2470
|
[[package]]
|
|
2472
2471
|
name = "wasm-bindgen-macro"
|
|
2473
|
-
version = "0.2.
|
|
2472
|
+
version = "0.2.123"
|
|
2474
2473
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2475
|
-
checksum = "
|
|
2474
|
+
checksum = "24a40fc75b0ec6f3746ceb10d36f53a93dcd68a93b11b6445983945d79eba0dc"
|
|
2476
2475
|
dependencies = [
|
|
2477
2476
|
"quote",
|
|
2478
2477
|
"wasm-bindgen-macro-support",
|
|
@@ -2480,9 +2479,9 @@ dependencies = [
|
|
|
2480
2479
|
|
|
2481
2480
|
[[package]]
|
|
2482
2481
|
name = "wasm-bindgen-macro-support"
|
|
2483
|
-
version = "0.2.
|
|
2482
|
+
version = "0.2.123"
|
|
2484
2483
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2485
|
-
checksum = "
|
|
2484
|
+
checksum = "908f34bd9b9ce3d4caf07b72dfab63d61504d156856c6bd3cd87fa350cf3985b"
|
|
2486
2485
|
dependencies = [
|
|
2487
2486
|
"bumpalo",
|
|
2488
2487
|
"proc-macro2",
|
|
@@ -2493,9 +2492,9 @@ dependencies = [
|
|
|
2493
2492
|
|
|
2494
2493
|
[[package]]
|
|
2495
2494
|
name = "wasm-bindgen-shared"
|
|
2496
|
-
version = "0.2.
|
|
2495
|
+
version = "0.2.123"
|
|
2497
2496
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2498
|
-
checksum = "
|
|
2497
|
+
checksum = "7acbf7616c27b194bbb550bf77ed0c2c3e5b7fd1260a93082b95fb7f47959b92"
|
|
2499
2498
|
dependencies = [
|
|
2500
2499
|
"unicode-ident",
|
|
2501
2500
|
]
|
|
@@ -2869,9 +2868,9 @@ checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
|
|
|
2869
2868
|
|
|
2870
2869
|
[[package]]
|
|
2871
2870
|
name = "yoke"
|
|
2872
|
-
version = "0.8.
|
|
2871
|
+
version = "0.8.3"
|
|
2873
2872
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2874
|
-
checksum = "
|
|
2873
|
+
checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
|
|
2875
2874
|
dependencies = [
|
|
2876
2875
|
"stable_deref_trait",
|
|
2877
2876
|
"yoke-derive",
|
|
@@ -2892,18 +2891,18 @@ dependencies = [
|
|
|
2892
2891
|
|
|
2893
2892
|
[[package]]
|
|
2894
2893
|
name = "zerocopy"
|
|
2895
|
-
version = "0.8.
|
|
2894
|
+
version = "0.8.52"
|
|
2896
2895
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2897
|
-
checksum = "
|
|
2896
|
+
checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f"
|
|
2898
2897
|
dependencies = [
|
|
2899
2898
|
"zerocopy-derive",
|
|
2900
2899
|
]
|
|
2901
2900
|
|
|
2902
2901
|
[[package]]
|
|
2903
2902
|
name = "zerocopy-derive"
|
|
2904
|
-
version = "0.8.
|
|
2903
|
+
version = "0.8.52"
|
|
2905
2904
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2906
|
-
checksum = "
|
|
2905
|
+
checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930"
|
|
2907
2906
|
dependencies = [
|
|
2908
2907
|
"proc-macro2",
|
|
2909
2908
|
"quote",
|
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented here.
|
|
4
4
|
|
|
5
|
+
## [0.13.6] - 2026-06-08
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **Auth Login Context**: Fixed `login_manager` extraction by correcting the attribute check on the request from `_app` to `app` ([#26](https://github.com/RUSTxPY/BustAPI/issues/26)).
|
|
9
|
+
- **Template Directory Handling**: Resolved duplicated fallback logic for template directories in `core/helpers.py` by streamlining the lookup against `current_app.template_folder` ([#25](https://github.com/RUSTxPY/BustAPI/issues/25)).
|
|
10
|
+
|
|
11
|
+
## [0.13.5] - 2026-06-04
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **Context Processor Tests**: Added comprehensive test cases (`test_issue_24.py`) to verify application-wide and blueprint-specific template context processors and CSRFProtect initialization.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- **CSRFProtect AttributeError**: Fixed an issue where initializing `CSRFProtect(app)` raised an `AttributeError` by implementing the `context_processor` decorator on the `BustAPI` application object.
|
|
18
|
+
- **Request Endpoint Resolution**: Mapped the active endpoint (`request.endpoint`) during route dispatch so that blueprint-specific context processors can be resolved and applied during template rendering.
|
|
19
|
+
|
|
5
20
|
## [0.13.4] - 2026-06-02
|
|
6
21
|
|
|
7
22
|
### Added
|
|
@@ -146,6 +146,15 @@ class BustAPI(
|
|
|
146
146
|
def register_blueprint(self, blueprint: Blueprint, **options) -> None:
|
|
147
147
|
url_prefix = options.get("url_prefix", blueprint.url_prefix)
|
|
148
148
|
self.blueprints[blueprint.name] = blueprint
|
|
149
|
+
|
|
150
|
+
# Register blueprint template context processors
|
|
151
|
+
self.template_context_processors.setdefault(blueprint.name, []).extend(
|
|
152
|
+
blueprint.context_processor_funcs
|
|
153
|
+
)
|
|
154
|
+
self.template_context_processors.setdefault(None, []).extend(
|
|
155
|
+
blueprint.app_context_processor_funcs
|
|
156
|
+
)
|
|
157
|
+
|
|
149
158
|
for rule, endpoint, view_func, methods in blueprint.deferred_functions:
|
|
150
159
|
if url_prefix:
|
|
151
160
|
rule = url_prefix.rstrip("/") + "/" + rule.lstrip("/")
|
|
@@ -115,7 +115,7 @@ def login_user(user, remember: bool = False, fresh: bool = True) -> bool:
|
|
|
115
115
|
return False
|
|
116
116
|
|
|
117
117
|
# Get login manager config
|
|
118
|
-
login_manager = getattr(request, "
|
|
118
|
+
login_manager = getattr(request, "app", None)
|
|
119
119
|
if login_manager:
|
|
120
120
|
login_manager = getattr(login_manager, "login_manager", None)
|
|
121
121
|
|
|
@@ -153,7 +153,7 @@ def logout_user() -> bool:
|
|
|
153
153
|
return False
|
|
154
154
|
|
|
155
155
|
# Get login manager config
|
|
156
|
-
login_manager = getattr(request, "
|
|
156
|
+
login_manager = getattr(request, "app", None)
|
|
157
157
|
if login_manager:
|
|
158
158
|
login_manager = getattr(login_manager, "login_manager", None)
|
|
159
159
|
|
|
@@ -86,6 +86,11 @@ class ContextManagement:
|
|
|
86
86
|
self.shell_context_processors.append(f)
|
|
87
87
|
return f
|
|
88
88
|
|
|
89
|
+
def context_processor(self, f):
|
|
90
|
+
"""Register a template context processor function."""
|
|
91
|
+
self.template_context_processors.setdefault(None, []).append(f)
|
|
92
|
+
return f
|
|
93
|
+
|
|
89
94
|
def make_shell_context(self):
|
|
90
95
|
"""Create shell context."""
|
|
91
96
|
context = {"app": self}
|
|
@@ -307,9 +307,7 @@ def render_template(template_name: str, **context) -> Response:
|
|
|
307
307
|
if template_dir is None:
|
|
308
308
|
try:
|
|
309
309
|
current_app = _get_current_object()
|
|
310
|
-
template_dir = (
|
|
311
|
-
getattr(current_app, "template_folder", None) or "templates"
|
|
312
|
-
)
|
|
310
|
+
template_dir = getattr(current_app, "template_folder", "templates")
|
|
313
311
|
except RuntimeError:
|
|
314
312
|
# No app context, use default
|
|
315
313
|
template_dir = "templates"
|
|
@@ -348,6 +346,31 @@ def render_template(template_name: str, **context) -> Response:
|
|
|
348
346
|
except RuntimeError:
|
|
349
347
|
pass
|
|
350
348
|
|
|
349
|
+
# Run template context processors
|
|
350
|
+
try:
|
|
351
|
+
current_app = _get_current_object()
|
|
352
|
+
if hasattr(current_app, "template_context_processors"):
|
|
353
|
+
# Run global processors
|
|
354
|
+
funcs = current_app.template_context_processors.get(None, [])
|
|
355
|
+
for func in funcs:
|
|
356
|
+
context.update(func())
|
|
357
|
+
|
|
358
|
+
# Run blueprint-specific processors
|
|
359
|
+
try:
|
|
360
|
+
from ..http.request import request as req
|
|
361
|
+
|
|
362
|
+
if req and getattr(req, "endpoint", None) and "." in req.endpoint:
|
|
363
|
+
bp_name = req.endpoint.split(".", 1)[0]
|
|
364
|
+
bp_funcs = current_app.template_context_processors.get(
|
|
365
|
+
bp_name, []
|
|
366
|
+
)
|
|
367
|
+
for func in bp_funcs:
|
|
368
|
+
context.update(func())
|
|
369
|
+
except Exception:
|
|
370
|
+
pass
|
|
371
|
+
except Exception:
|
|
372
|
+
pass
|
|
373
|
+
|
|
351
374
|
# Load and render template
|
|
352
375
|
template = env.get_template(template_name)
|
|
353
376
|
html = template.render(**context)
|
|
@@ -112,6 +112,15 @@ def create_sync_wrapper(app: "BustAPI", handler: Callable, rule: str) -> Callabl
|
|
|
112
112
|
# 1. Context and Request Initialization (Fast Path)
|
|
113
113
|
request = Request._from_rust_request(rust_request)
|
|
114
114
|
request.app = app
|
|
115
|
+
|
|
116
|
+
# Find and set endpoint
|
|
117
|
+
endpoint = None
|
|
118
|
+
for ep, func in app.view_functions.items():
|
|
119
|
+
if func is handler:
|
|
120
|
+
endpoint = ep
|
|
121
|
+
break
|
|
122
|
+
request.endpoint = endpoint
|
|
123
|
+
|
|
115
124
|
token = _request_ctx.set(request)
|
|
116
125
|
|
|
117
126
|
# 2. Session Initialization
|
|
@@ -299,6 +308,15 @@ def create_async_wrapper(app: "BustAPI", handler: Callable, rule: str) -> Callab
|
|
|
299
308
|
async def run_logic():
|
|
300
309
|
request = Request._from_rust_request(rust_request)
|
|
301
310
|
request.app = app
|
|
311
|
+
|
|
312
|
+
# Find and set endpoint
|
|
313
|
+
endpoint = None
|
|
314
|
+
for ep, func in app.view_functions.items():
|
|
315
|
+
if func is handler:
|
|
316
|
+
endpoint = ep
|
|
317
|
+
break
|
|
318
|
+
request.endpoint = endpoint
|
|
319
|
+
|
|
302
320
|
token = _request_ctx.set(request)
|
|
303
321
|
|
|
304
322
|
try:
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
from bustapi import BustAPI, CSRFProtect, render_template
|
|
6
|
+
from bustapi.routing.blueprints import Blueprint
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.fixture
|
|
10
|
+
def app_with_csrf():
|
|
11
|
+
app = BustAPI(import_name="test_app_csrf")
|
|
12
|
+
app.secret_key = "test-secret-key"
|
|
13
|
+
|
|
14
|
+
# Initialize CSRFProtect
|
|
15
|
+
csrf = CSRFProtect(app)
|
|
16
|
+
|
|
17
|
+
# Setup templates
|
|
18
|
+
template_dir = os.path.join(os.getcwd(), "templates_test_24")
|
|
19
|
+
os.makedirs(template_dir, exist_ok=True)
|
|
20
|
+
|
|
21
|
+
with open(os.path.join(template_dir, "index.html"), "w") as f:
|
|
22
|
+
f.write("<html><body>csrf_token: {{ csrf_token() }}</body></html>")
|
|
23
|
+
|
|
24
|
+
with open(os.path.join(template_dir, "bp.html"), "w") as f:
|
|
25
|
+
f.write(
|
|
26
|
+
"<html><body>csrf_token: {{ csrf_token() }}, bp_val: {{ bp_val }}</body></html>"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
app.template_folder = template_dir
|
|
30
|
+
|
|
31
|
+
# Add custom app-wide context processor
|
|
32
|
+
@app.context_processor
|
|
33
|
+
def app_processor():
|
|
34
|
+
return {"app_val": "app-wide"}
|
|
35
|
+
|
|
36
|
+
# Create Blueprint and register context processor
|
|
37
|
+
bp = Blueprint("test_bp", "test_bp_module")
|
|
38
|
+
|
|
39
|
+
@bp.context_processor
|
|
40
|
+
def bp_processor():
|
|
41
|
+
return {"bp_val": "blueprint-specific"}
|
|
42
|
+
|
|
43
|
+
@bp.route("/bp-view")
|
|
44
|
+
def bp_view():
|
|
45
|
+
return render_template("bp.html")
|
|
46
|
+
|
|
47
|
+
app.register_blueprint(bp)
|
|
48
|
+
|
|
49
|
+
@app.route("/")
|
|
50
|
+
def index():
|
|
51
|
+
return render_template("index.html")
|
|
52
|
+
|
|
53
|
+
yield app
|
|
54
|
+
|
|
55
|
+
# Cleanup
|
|
56
|
+
shutil.rmtree(template_dir, ignore_errors=True)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_csrf_initialization(app_with_csrf):
|
|
60
|
+
"""Test that CSRFProtect initializes without AttributeError."""
|
|
61
|
+
assert "csrf" in app_with_csrf.extensions
|
|
62
|
+
assert isinstance(app_with_csrf.extensions["csrf"], CSRFProtect)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_csrf_token_in_context(app_with_csrf):
|
|
66
|
+
"""Test that csrf_token is available and callable in the template context."""
|
|
67
|
+
with app_with_csrf.test_client() as client:
|
|
68
|
+
# Create session transaction to have a session so _get_csrf_token doesn't return empty
|
|
69
|
+
with client.session_transaction() as sess:
|
|
70
|
+
sess["_csrf_token"] = "test-csrf-value"
|
|
71
|
+
|
|
72
|
+
resp = client.get("/")
|
|
73
|
+
assert resp.status_code == 200
|
|
74
|
+
assert "csrf_token: test-csrf-value" in resp.text
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def test_blueprint_context_processor(app_with_csrf):
|
|
78
|
+
"""Test that blueprint-specific context processor gets applied only in blueprint context."""
|
|
79
|
+
with app_with_csrf.test_client() as client:
|
|
80
|
+
# Test main app template does not have bp_val (it would error if used, or render empty/none)
|
|
81
|
+
# Test blueprint template has both csrf_token and bp_val
|
|
82
|
+
with client.session_transaction() as sess:
|
|
83
|
+
sess["_csrf_token"] = "test-csrf-value"
|
|
84
|
+
|
|
85
|
+
resp = client.get("/bp-view")
|
|
86
|
+
assert resp.status_code == 200
|
|
87
|
+
assert "csrf_token: test-csrf-value" in resp.text
|
|
88
|
+
assert "bp_val: blueprint-specific" in resp.text
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|