0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-23 22:54:07 +01:00

Speed up get_domain_from_id

This commit is contained in:
Erik Johnston 2017-05-16 14:07:08 +01:00
parent b8492b6c2f
commit f2a5b6dbfd

View file

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