summary refs log tree commit diff
path: root/synapse/events/builder.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-01-25 10:26:13 +0000
committerGitHub <noreply@github.com>2019-01-25 10:26:13 +0000
commit829a7b20325aa35ecca11624baf68ebdb247e123 (patch)
tree08902e6b1564b865a5b21194c844d85a693ef095 /synapse/events/builder.py
parentMerge pull request #4451 from matrix-org/erikj/require_format_version (diff)
parentRevert "Require event format version to parse or create events" (diff)
downloadsynapse-829a7b20325aa35ecca11624baf68ebdb247e123.tar.xz
Merge pull request #4469 from matrix-org/revert-4451-erikj/require_format_version
Revert "Require event format version to parse or create events"
Diffstat (limited to 'synapse/events/builder.py')
-rw-r--r--synapse/events/builder.py51
1 files changed, 1 insertions, 50 deletions
diff --git a/synapse/events/builder.py b/synapse/events/builder.py
index 7e63371095..e662eaef10 100644
--- a/synapse/events/builder.py
+++ b/synapse/events/builder.py
@@ -15,39 +15,12 @@
 
 import copy
 
-from synapse.api.constants import RoomVersions
 from synapse.types import EventID
 from synapse.util.stringutils import random_string
 
 from . import EventBase, FrozenEvent, _event_dict_property
 
 
-def get_event_builder(room_version, key_values={}, internal_metadata_dict={}):
-    """Generate an event builder appropriate for the given room version
-
-    Args:
-        room_version (str): Version of the room that we're creating an
-            event builder for
-        key_values (dict): Fields used as the basis of the new event
-        internal_metadata_dict (dict): Used to create the `_EventInternalMetadata`
-            object.
-
-    Returns:
-        EventBuilder
-    """
-    if room_version in {
-        RoomVersions.V1,
-        RoomVersions.V2,
-        RoomVersions.VDH_TEST,
-        RoomVersions.STATE_V2_TEST,
-    }:
-        return EventBuilder(key_values, internal_metadata_dict)
-    else:
-        raise Exception(
-            "No event format defined for version %r" % (room_version,)
-        )
-
-
 class EventBuilder(EventBase):
     def __init__(self, key_values={}, internal_metadata_dict={}):
         signatures = copy.deepcopy(key_values.pop("signatures", {}))
@@ -85,29 +58,7 @@ class EventBuilderFactory(object):
 
         return e_id.to_string()
 
-    def new(self, room_version, key_values={}):
-        """Generate an event builder appropriate for the given room version
-
-        Args:
-            room_version (str): Version of the room that we're creating an
-                event builder for
-            key_values (dict): Fields used as the basis of the new event
-
-        Returns:
-            EventBuilder
-        """
-
-        # There's currently only the one event version defined
-        if room_version not in {
-            RoomVersions.V1,
-            RoomVersions.V2,
-            RoomVersions.VDH_TEST,
-            RoomVersions.STATE_V2_TEST,
-        }:
-            raise Exception(
-                "No event format defined for version %r" % (room_version,)
-            )
-
+    def new(self, key_values={}):
         key_values["event_id"] = self.create_event_id()
 
         time_now = int(self.clock.time_msec())