Intercept routing exceptions and possibly do something else. In debug mode, intercept a routing redirect and replace it with an error if the body will be discarded. With modern Werkzeug this shouldn't occur, since it now uses a 308 status which tells the browser to
(self, request: Request)
| 476 | return None |
| 477 | |
| 478 | def raise_routing_exception(self, request: Request) -> t.NoReturn: |
| 479 | """Intercept routing exceptions and possibly do something else. |
| 480 | |
| 481 | In debug mode, intercept a routing redirect and replace it with |
| 482 | an error if the body will be discarded. |
| 483 | |
| 484 | With modern Werkzeug this shouldn't occur, since it now uses a |
| 485 | 308 status which tells the browser to resend the method and |
| 486 | body. |
| 487 | |
| 488 | .. versionchanged:: 2.1 |
| 489 | Don't intercept 307 and 308 redirects. |
| 490 | |
| 491 | :meta private: |
| 492 | :internal: |
| 493 | """ |
| 494 | if ( |
| 495 | not self.debug |
| 496 | or not isinstance(request.routing_exception, RequestRedirect) |
| 497 | or request.routing_exception.code in {307, 308} |
| 498 | or request.method in {"GET", "HEAD", "OPTIONS"} |
| 499 | ): |
| 500 | raise request.routing_exception # type: ignore[misc] |
| 501 | |
| 502 | from .debughelpers import FormDataRoutingRedirect |
| 503 | |
| 504 | raise FormDataRoutingRedirect(request) |
| 505 | |
| 506 | def update_template_context(self, context: dict[str, t.Any]) -> None: |
| 507 | """Update the template context with some commonly used variables. |
no test coverage detected