Ensure history states can be copied (#37081)
The filter integration makes a copy of a state object obtained from history.
This commit is contained in:
1 parent
5bc6ed4cef
commit
f4528d0db2
2 files changed
+46
-2
No files matched your search
@@ -616,7 +616,7 @@ class LazyState(State):
|
||||
self._last_updated = None
|
||||
self._context = None
|
||||
|
||||
@property
|
||||
@property # type: ignore
|
||||
def attributes(self):
|
||||
"""State attributes."""
|
||||
if not self._attributes:
|
||||
@@ -628,13 +628,23 @@ class LazyState(State):
|
||||
self._attributes = {}
|
||||
return self._attributes
|
||||
|
||||
@property
|
||||
@attributes.setter
|
||||
def attributes(self, value):
|
||||
"""Set attributes."""
|
||||
self._attributes = value
|
||||
|
||||
@property # type: ignore
|
||||
def context(self):
|
||||
"""State context."""
|
||||
if not self._context:
|
||||
self._context = Context(id=None)
|
||||
return self._context
|
||||
|
||||
@context.setter
|
||||
def context(self, value):
|
||||
"""Set context."""
|
||||
self._context = value
|
||||
|
||||
@property # type: ignore
|
||||
def last_changed(self):
|
||||
"""Last changed datetime."""
|
||||
|
||||
Reference in new issue
Block a user