pboot 4.0.1__tar.gz → 4.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pboot-4.0.1 → pboot-4.0.2}/CHANGES.rst +10 -0
- {pboot-4.0.1 → pboot-4.0.2}/PKG-INFO +1 -1
- {pboot-4.0.1 → pboot-4.0.2}/pyproject.toml +1 -1
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/__init__.py +1 -1
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/blueprints.py +12 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_blueprints.py +24 -0
- {pboot-4.0.1 → pboot-4.0.2}/LICENSE.txt +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/README.md +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/docs/_static/pboot-logo.svg +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/docs/migration-from-flask.md +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/examples/api/app.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/examples/basic/app.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/examples/templates/app.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/examples/templates/templates/index.html +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/__main__.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_body_limit.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_compat/__init__.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_compat/shared.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_compat/v2.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_datastructures.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_form_limits.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_import.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/_local.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/app.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/applications.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/background.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/cli.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/compat.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/concurrency.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/config.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/ctx.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/datastructures.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/debughelpers.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/dependencies/__init__.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/dependencies/models.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/dependencies/utils.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/encoders.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/exception_handlers.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/exceptions.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/globals.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/helpers.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/json/__init__.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/json/provider.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/json/tag.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/logger.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/logging.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/__init__.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/asyncexitstack.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/cors.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/gzip.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/httpsredirect.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/trustedhost.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/middleware/wsgi.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/openapi/__init__.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/openapi/constants.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/openapi/docs.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/openapi/models.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/openapi/utils.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/param_functions.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/params.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/py.typed +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/requests.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/responses.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/routing.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sansio/__init__.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sansio/app.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sansio/blueprints.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sansio/scaffold.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/__init__.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/api_key.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/base.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/http.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/oauth2.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/open_id_connect_url.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/security/utils.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sessions.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/signals.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/sse.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/staticfiles.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/telemetry/__init__.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/telemetry/_api.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/telemetry/_asgi.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/telemetry/_runtime.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/templating.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/testclient.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/testing.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/types.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/typing.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/utils.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/views.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/websockets.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/src/pboot/wrappers.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/conftest.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/templates/hello.html +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_appctx.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_basic.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_cli.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_compat_api.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_config.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_error_handlers.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_fastapi.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_helpers.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_json.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_reqctx.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_session.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_signals.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_templating.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_testing.py +0 -0
- {pboot-4.0.1 → pboot-4.0.2}/tests/test_views.py +0 -0
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
Version 4.0.2
|
|
2
|
+
-------------
|
|
3
|
+
|
|
4
|
+
Released 2026-12-02
|
|
5
|
+
|
|
6
|
+
- Fix the endpoint names of the FastAPI style routes registered on a
|
|
7
|
+
blueprint. They are now prefixed with the blueprint name, so that
|
|
8
|
+
``url_for("api.item")`` works the same way as for the Flask style
|
|
9
|
+
routes.
|
|
10
|
+
|
|
1
11
|
Version 4.0.1
|
|
2
12
|
-------------
|
|
3
13
|
|
|
@@ -401,6 +401,18 @@ class Blueprint:
|
|
|
401
401
|
app.register_error_handler(code_or_exception, f)
|
|
402
402
|
|
|
403
403
|
if self.router.routes:
|
|
404
|
+
# 端点名与 Flask 保持一致, 形如 "蓝图名.视图名"。
|
|
405
|
+
if not hasattr(self, "_original_route_names"):
|
|
406
|
+
self._original_route_names = {
|
|
407
|
+
id(route): t.cast("t.Any", route).name
|
|
408
|
+
for route in self.router.routes
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
for route in self.router.routes:
|
|
412
|
+
named = t.cast("t.Any", route)
|
|
413
|
+
original = self._original_route_names.get(id(route), named.name)
|
|
414
|
+
named.name = f"{full_name}.{original}"
|
|
415
|
+
|
|
404
416
|
app.include_router(self.router, prefix=self.url_prefix or "")
|
|
405
417
|
|
|
406
418
|
app.blueprints[full_name] = self
|
|
@@ -205,3 +205,27 @@ def test_blueprint_method_decorators(app, client):
|
|
|
205
205
|
|
|
206
206
|
assert client.post("/create").json() == {"created": True}
|
|
207
207
|
assert client.delete("/remove").json() == {"removed": True}
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def test_blueprint_url_for_fastapi_style(app):
|
|
211
|
+
bp = Blueprint("api", __name__, url_prefix="/api")
|
|
212
|
+
|
|
213
|
+
@bp.get("/items/{item_id}")
|
|
214
|
+
async def item(item_id: int):
|
|
215
|
+
return {"id": item_id}
|
|
216
|
+
|
|
217
|
+
app.register_blueprint(bp)
|
|
218
|
+
|
|
219
|
+
assert app.url_for("api.item", item_id=3) == "/api/items/3"
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def test_blueprint_url_for_flask_style(app):
|
|
223
|
+
bp = Blueprint("api", __name__, url_prefix="/api")
|
|
224
|
+
|
|
225
|
+
@bp.route("/hello/<name>")
|
|
226
|
+
async def hello(name):
|
|
227
|
+
return name
|
|
228
|
+
|
|
229
|
+
app.register_blueprint(bp)
|
|
230
|
+
|
|
231
|
+
assert app.url_for("api.hello", name="x") == "/api/hello/x"
|
|
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
|
|
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
|