Convert rest and handlers to use new event structure

This commit is contained in:
Erik Johnston 2014-12-04 15:50:01 +00:00
parent 5d7c9ab789
commit c31dba86ec
14 changed files with 188 additions and 199 deletions

View file

@ -85,10 +85,10 @@ class EventBase(object):
return hasattr(self, "state_key")
def get_dict(self):
d = dict(self._original)
d = dict(self._event_dict)
d.update({
"signatures": self._signatures,
"unsigned": self._unsigned,
"signatures": self.signatures,
"unsigned": self.unsigned,
})
return d
@ -128,7 +128,7 @@ class FrozenEvent(EventBase):
@staticmethod
def from_event(event):
e = FrozenEvent(
event.event_dict()
event.get_pdu_json()
)
e.internal_metadata = event.internal_metadata

View file

@ -22,10 +22,13 @@ from synapse.util.stringutils import random_string
class EventBuilder(EventBase):
def __init__(self, key_values={}):
super(FrozenEvent, self).__init__(
super(EventBuilder, self).__init__(
key_values,
)
def update_event_key(self, key, value):
self._event_dict[key] = value
def update_event_keys(self, other_dict):
self._event_dict.update(other_dict)