Deny __iter__ on UserID/RoomID/RoomName instances as it's a subtle bug that will bite you

This commit is contained in:
Paul "LeoNerd" Evans 2014-08-18 16:07:14 +01:00
parent bb793019a5
commit 6fafa878f6

View file

@ -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."""