diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-08-18 16:07:14 +0100 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-08-19 11:16:23 +0100 |
commit | 6fafa878f6968af3041ae7265f0ef11854bb254f (patch) | |
tree | d5f123866790db4a738a01837467016252475319 /synapse | |
parent | Rename MockHttpServer to MockHttpResource as it stands for one server resourc... (diff) | |
download | synapse-6fafa878f6968af3041ae7265f0ef11854bb254f.tar.xz |
Deny __iter__ on UserID/RoomID/RoomName instances as it's a subtle bug that will bite you
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/types.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/types.py b/synapse/types.py index 054b1e713c..b8e191bb3c 100644 --- a/synapse/types.py +++ b/synapse/types.py @@ -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.""" |