VMM/EmailAddress: implemented EmailAddress.__hash__(). v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Sat, 27 Feb 2010 09:28:33 +0000
branchv0.6.x
changeset 218 84094c7fa28b
parent 217 eecd05e31517
child 219 0b6ce895e1dc
VMM/EmailAddress: implemented EmailAddress.__hash__(). So we can have a set() of EmailAddress instances.
VirtualMailManager/EmailAddress.py
--- a/VirtualMailManager/EmailAddress.py	Sat Feb 27 06:24:20 2010 +0000
+++ b/VirtualMailManager/EmailAddress.py	Sat Feb 27 09:28:33 2010 +0000
@@ -50,6 +50,9 @@
                     self._domainname != other.domainname
         return NotImplemented
 
+    def __hash__(self):
+        return hash((self._localpart.lower(), self._domainname.lower()))
+
     def __repr__(self):
         return "EmailAddress('%s@%s')" % (self._localpart, self._domainname)