Merge pull request #2226 from matrix-org/erikj/domain_from_id

Speed up get_domain_from_id
This commit is contained in:
Erik Johnston 2017-05-16 17:18:16 +01:00 committed by GitHub
commit 11bc21b6d9

View file

@ -56,10 +56,10 @@ def create_requester(user_id, access_token_id=None, is_guest=False,
def get_domain_from_id(string):
try:
return string.split(":", 1)[1]
except IndexError:
idx = string.find(":")
if idx == -1:
raise SynapseError(400, "Invalid ID: %r" % (string,))
return string[idx + 1:]
class DomainSpecificString(