Skip to content
Unverified Commit 4f76e35f authored by Burak's avatar Burak Committed by GitHub
Browse files

Python: map Python middlewares to Tower layers (#1871)



* Python: map Python middlewares to Tower layers

* Make middleware layer infallible

* Use message and status code from `PyMiddlewareException`

* Introduce `FuncMetadata` to represent some information about a Python function

* Improve middleware errors

* Add missing copyright headers

* Allow accessing and changing request body

* Allow changing response

* Add some documentation about moving data back-and-forth between Rust and Python

* Add `mypy` to Pokemon service and update typings and comments for middlewares

* Add or update comments on the important types

* Add Rust equivalent of `collections.abc.MutableMapping`

* Add `PyHeaderMap` to make `HeaderMap` accessible from Python

* Apply suggestions from code review

Co-authored-by: default avatarLuca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>

* Improve logging

* Add `RichPyErr` to have a better output for `PyErr`s

* Better error messages for `PyMiddlewareError` variants

* Factor out repeating patterns in tests

* Preserve `__builtins__` in `globals` to fix tests in Python 3.7.10 (our CI version)

* Export `RichPyErr` to fix `cargo doc` error

* Apply suggestions from code review

Co-authored-by: default avatarMatteo Bigoi <1781140+crisidev@users.noreply.github.com>

* Add missing SPDX headers

* Document that `keys`, `values` and `items` on `PyMutableMapping` causes clones

Co-authored-by: default avatarLuca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
Co-authored-by: default avatarMatteo Bigoi <1781140+crisidev@users.noreply.github.com>
parent b82b6a65
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment