summary refs log tree commit diff
path: root/synapse/types.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-06-01 15:39:32 +0100
committerGitHub <noreply@github.com>2017-06-01 15:39:32 +0100
commit87e5e05aeae3f921f17af4d57cfec6e15f104c42 (patch)
tree45228bb7292a2cabd0a7c89ecaab42f7d33d3569 /synapse/types.py
parentMerge pull request #2251 from matrix-org/erikj/current_state_delta_stream (diff)
parentFix sqlite (diff)
downloadsynapse-87e5e05aeae3f921f17af4d57cfec6e15f104c42.tar.xz
Merge pull request #2252 from matrix-org/erikj/user_dir
Add a user directory
Diffstat (limited to 'synapse/types.py')
-rw-r--r--synapse/types.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/types.py b/synapse/types.py

index 445bdcb4d7..111948540d 100644 --- a/synapse/types.py +++ b/synapse/types.py
@@ -62,6 +62,13 @@ def get_domain_from_id(string): return string[idx + 1:] +def get_localpart_from_id(string): + idx = string.find(":") + if idx == -1: + raise SynapseError(400, "Invalid ID: %r" % (string,)) + return string[1:idx] + + class DomainSpecificString( namedtuple("DomainSpecificString", ("localpart", "domain")) ):