diff options
author | Erik Johnston <erik@matrix.org> | 2014-08-15 16:06:08 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-08-15 16:06:08 +0100 |
commit | 19946509a4ddbdd647261f9f19358e6f1f0e337b (patch) | |
tree | b1c20c645492901c14c54d3e4085ac94c5acf6e6 /synapse/api/events/factory.py | |
parent | Fix bug when generating a key when get_room_events_stream returned zero rows (diff) | |
download | synapse-19946509a4ddbdd647261f9f19358e6f1f0e337b.tar.xz |
Support generic events.
Diffstat (limited to 'synapse/api/events/factory.py')
-rw-r--r-- | synapse/api/events/factory.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/synapse/api/events/factory.py b/synapse/api/events/factory.py index 23d2b0401c..b61dac7acd 100644 --- a/synapse/api/events/factory.py +++ b/synapse/api/events/factory.py @@ -15,7 +15,7 @@ from synapse.api.events.room import ( RoomTopicEvent, MessageEvent, RoomMemberEvent, FeedbackEvent, - InviteJoinEvent, RoomConfigEvent, RoomNameEvent, + InviteJoinEvent, RoomConfigEvent, RoomNameEvent, GenericEvent, ) from synapse.util.stringutils import random_string @@ -43,10 +43,9 @@ class EventFactory(object): if "event_id" not in kwargs: kwargs["event_id"] = random_string(10) - try: + if etype in self._event_list: handler = self._event_list[etype] - except KeyError: # unknown event type - # TODO allow custom event types. - raise NotImplementedError("Unknown etype=%s" % etype) + else: + handler = GenericEvent return handler(**kwargs) |