Skip to content
Snippets Groups Projects
Commit 6a67081c authored by Simon Künzel's avatar Simon Künzel
Browse files

Fix context serialization bug

parent 62f02fbc
No related branches found
No related tags found
No related merge requests found
......@@ -6,5 +6,6 @@ from .object import (
VisibilityApiObject,
api_mapped,
api_include_in_data,
NoSerializationContext
)
from .object_class import ApiObjectClass
......@@ -37,6 +37,22 @@ def api_include_in_data(
return decorator
class NoSerializationContext(dict):
"""
A dict which can be used as a context for serialize() to prevent any serialization of objects of a specific type.
This dict pretends like all keys are already present. Actually retrieving or updating an item throws an error
"""
def __setitem__(self, __key, __value):
raise Exception("Not supported")
def __getitem__(self, __key):
raise Exception("Not supported")
def __contains__(self, __key):
return True
API_VALUE_OBJECT_CLASSES_BY_ID: dict[str, type["ApiValueObject"]] = {}
_disable_value_object_registration = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment