diff --git a/binding/python/examples/main.py b/binding/python/examples/main.py index e54090ef..7a607874 100644 --- a/binding/python/examples/main.py +++ b/binding/python/examples/main.py @@ -73,7 +73,7 @@ async def __aexit__(self, exc_type, exc, tb): @routes.get("/get/{id}") async def get(request: web.Request) -> web.Response: - store = request.app["state"]["store"] + store: HashStore = request.app["state"]["store"] id = request.match_info["id"] return web.Response(text=store.get(id)) diff --git a/binding/python/src/bindings/state_machine.rs b/binding/python/src/bindings/state_machine.rs index 3ef9d732..851d14fc 100644 --- a/binding/python/src/bindings/state_machine.rs +++ b/binding/python/src/bindings/state_machine.rs @@ -78,6 +78,15 @@ impl AbstractLogEntry for PyLogEntry { } } +#[pymethods] +impl PyLogEntry { + fn __getattr__(&self, py: Python, attr: &str) -> PyResult { + let log_entry: &PyAny = self.log_entry.as_ref(py); + let attr_value = log_entry.getattr(attr)?; + Ok(Py::from(attr_value)) + } +} + #[derive(Clone)] #[pyclass(name = "AbstractStateMachine")] pub struct PyFSM { @@ -114,7 +123,7 @@ impl fmt::Display for PyFSM { } } -#[pymethods] +#[pymethods] impl PyFSM { fn __getattr__(&self, py: Python, attr: &str) -> PyResult { let store: &PyAny = self.store.as_ref(py);