mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-26 04:05:38 +00:00
SYN-252: Supply the stream and topological parts in the correct order to the constructor
This commit is contained in:
parent
d5bdf3c0c7
commit
b0b80074e0
@ -82,10 +82,10 @@ class _StreamToken(namedtuple("_StreamToken", "topological stream")):
|
|||||||
def parse(cls, string):
|
def parse(cls, string):
|
||||||
try:
|
try:
|
||||||
if string[0] == 's':
|
if string[0] == 's':
|
||||||
return cls(None, int(string[1:]))
|
return cls(topological=None, stream=int(string[1:]))
|
||||||
if string[0] == 't':
|
if string[0] == 't':
|
||||||
parts = string[1:].split('-', 1)
|
parts = string[1:].split('-', 1)
|
||||||
return cls(int(parts[1]), int(parts[0]))
|
return cls(topological=int(parts[0]), stream=int(parts[1]))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
raise SynapseError(400, "Invalid token %r" % (string,))
|
raise SynapseError(400, "Invalid token %r" % (string,))
|
||||||
@ -94,7 +94,7 @@ class _StreamToken(namedtuple("_StreamToken", "topological stream")):
|
|||||||
def parse_stream_token(cls, string):
|
def parse_stream_token(cls, string):
|
||||||
try:
|
try:
|
||||||
if string[0] == 's':
|
if string[0] == 's':
|
||||||
return cls(None, int(string[1:]))
|
return cls(topological=None, stream=int(string[1:]))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
raise SynapseError(400, "Invalid token %r" % (string,))
|
raise SynapseError(400, "Invalid token %r" % (string,))
|
||||||
|
Loading…
Reference in New Issue
Block a user