fix backend vars

This commit is contained in:
Benedikt Bartscher 2024-02-29 00:01:15 +01:00
parent 67c81489cf
commit 66f1e21576
No known key found for this signature in database

View File

@ -155,6 +155,9 @@ RESERVED_BACKEND_VAR_NAMES = {
"_was_touched",
}
SPECIAL_METHODS = {
"model_post_init", # never treat this as an event handler
}
def _substate_key(
token: str,
@ -517,6 +520,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
"""
return (
not name.startswith("_")
and name not in SPECIAL_METHODS
and isinstance(value, Callable)
and not isinstance(value, EventHandler)
and hasattr(value, "__code__")