fix: intengrate data read model

Signed-off-by: Alexander Tkachev <sasha64sasha@gmail.com>
This commit is contained in:
Alexander Tkachev 2022-07-23 00:40:40 +03:00
parent 56489682c5
commit 09062e35ff
1 changed files with 3 additions and 7 deletions

View File

@ -52,7 +52,7 @@ class CloudEvent(abstract.CloudEvent):
:type data: typing.Any
"""
self._attributes = {k.lower(): v for k, v in attributes.items()}
self._data = data
self.data = data
if "specversion" not in self._attributes:
self._attributes["specversion"] = "1.0"
if "id" not in self._attributes:
@ -79,12 +79,8 @@ class CloudEvent(abstract.CloudEvent):
return self._attributes
@property
def data(self) -> typing.Optional[typing.Any]:
return self._data
@data.setter
def data(self, value) -> None:
self._data = value
def _data_read_model(self) -> typing.Optional[typing.Any]:
return self.data
def __setitem__(self, key: str, value: typing.Any) -> None:
self._attributes[key] = value