mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-18 08:54:54 +03:00
Deny __iter__ on UserID/RoomID/RoomName instances as it's a subtle bug that will bite you
This commit is contained in:
parent
bb793019a5
commit
6fafa878f6
1 changed files with 6 additions and 0 deletions
|
@ -32,6 +32,12 @@ class DomainSpecificString(
|
|||
HomeServer as being its own
|
||||
"""
|
||||
|
||||
# Deny iteration because it will bite you if you try to create a singleton
|
||||
# set by:
|
||||
# users = set(user)
|
||||
def __iter__(self):
|
||||
raise ValueError("Attempted to iterate a %s" % (type(self).__name__))
|
||||
|
||||
@classmethod
|
||||
def from_string(cls, s, hs):
|
||||
"""Parse the string given by 's' into a structure object."""
|
||||
|
|
Loading…
Reference in a new issue