diff -r 21f264a88ab2 -r 949c5db6447a VirtualMailManager/EmailAddress.py --- a/VirtualMailManager/EmailAddress.py Tue Aug 18 03:00:00 2009 +0000 +++ b/VirtualMailManager/EmailAddress.py Tue Aug 18 05:08:51 2009 +0000 @@ -20,20 +20,18 @@ self._localpart = None self._domainname = None self.__chkAddress(address) - + def __eq__(self, other): - if hasattr(other, '_localpart') and hasattr(other, '_domainname'): + if isinstance(other, self.__class__): return self._localpart == other._localpart\ and self._domainname == other._domainname - else: - return NotImplemented + return NotImplemented def __ne__(self, other): - if hasattr(other, '_localpart') and hasattr(other, '_domainname'): - return not self._localpart == other._localpart\ - and self._domainname == other._domainname - else: - return NotImplemented + if isinstance(other, self.__class__): + return self._localpart != other._localpart\ + or self._domainname != other._domainname + return NotImplemented def __repr__(self): return "EmailAddress('%s@%s')" % (self._localpart, self._domainname) @@ -60,7 +58,7 @@ def __chkLocalpart(self, localpart): """Validates the local part of an e-mail address. - + Keyword arguments: localpart -- of the e-mail address that should be validated (str) """