summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2014-08-29 17:31:33 +0100
committerPaul "LeoNerd" Evans <paul@matrix.org>2014-08-29 17:31:39 +0100
commitf85a3757cf5d0aafc575423f2147e5821d8d5a67 (patch)
treef48009886a1906312dbf26e8192d864f082f559d
parentoops. Should not have c+p all lines (diff)
downloadsynapse-f85a3757cf5d0aafc575423f2147e5821d8d5a67.tar.xz
Avoid hardcoding names of individual stream token keys in its own implementation; this at least reduces the number of places in source code the individual parts are stored
-rw-r--r--synapse/types.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/synapse/types.py b/synapse/types.py
index abc3031eae..aa6f589a20 100644
--- a/synapse/types.py
+++ b/synapse/types.py
@@ -105,20 +105,14 @@ class StreamToken(
     @classmethod
     def from_string(cls, string):
         try:
-            events_key, presence_key = string.split(cls._SEPARATOR)
+            keys = string.split(cls._SEPARATOR)
 
-            return cls(
-                events_key=events_key,
-                presence_key=presence_key,
-            )
+            return cls(*keys)
         except:
             raise SynapseError(400, "Invalid Token")
 
     def to_string(self):
-        return self._SEPARATOR.join([
-            str(self.events_key),
-            str(self.presence_key),
-        ])
+        return self._SEPARATOR.join([str(k) for k in self])
 
     def copy_and_replace(self, key, new_value):
         d = self._asdict()