concordance
changeset 192:fb3e6028ffe0
Added Address.__eq__ method for testing JIDs for a match
| author | Arc Riley <arcriley@gmail.com> |
|---|---|
| date | Thu, 02 Dec 2010 23:10:47 -0500 |
| parents | 3428a8c07391 |
| children | 3956ca8041ef |
| files | src/__init__.py |
| diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line diff
1.1 --- a/src/__init__.py Thu Dec 02 22:13:28 2010 -0500 1.2 +++ b/src/__init__.py Thu Dec 02 23:10:47 2010 -0500 1.3 @@ -206,6 +206,18 @@ 1.4 def __repr__ (self) : 1.5 return '<Address "%s">' % str(self) 1.6 1.7 + def __eq__ (self, value) : 1.8 + # If comparing against a string, convert it to an Address first 1.9 + if type(value) is str : 1.10 + value = Address(value) 1.11 + 1.12 + # Addresses can only be equal to other addresses 1.13 + if type(self) is not type(value) : 1.14 + return False 1.15 + 1.16 + # Return true if stored values are the same 1.17 + return self.__store__ == value.__store__ 1.18 + 1.19 1.20 def Application (cls) : 1.21 ''' concordance.Application class decorator
