diff options
author | Mark Spruiell <mes@zeroc.com> | 2007-07-17 16:01:09 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2007-07-17 16:02:13 -0700 |
commit | 6471addf903e0f31b1e18c159d9c62715fb7bf49 (patch) | |
tree | d345c4e8fe9d8505f89aa06274a260e47df2c10f /py/python/Ice.py | |
parent | Added stringConverter (diff) | |
download | ice-6471addf903e0f31b1e18c159d9c62715fb7bf49.tar.bz2 ice-6471addf903e0f31b1e18c159d9c62715fb7bf49.tar.xz ice-6471addf903e0f31b1e18c159d9c62715fb7bf49.zip |
bug 2106: proxyAndIdentityFacet methods
Diffstat (limited to 'py/python/Ice.py')
-rw-r--r-- | py/python/Ice.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/py/python/Ice.py b/py/python/Ice.py index a0b55ee41dc..ae0dba80962 100644 --- a/py/python/Ice.py +++ b/py/python/Ice.py @@ -1036,25 +1036,33 @@ del ConnectionLostException__str__ # Proxy comparison functions. # def proxyIdentityEqual(lhs, rhs): + return proxyIdentityCompare(lhs, rhs) == 0 + +def proxyIdentityCompare(lhs, rhs): if (lhs and not isinstance(lhs, ObjectPrx)) or (rhs and not isinstance(rhs, ObjectPrx)): raise ValueError('argument is not a proxy') if not lhs and not rhs: return True elif not lhs and rhs: - return False + return -1 elif lhs and not rhs: - return False + return 1 else: - return lhs.ice_getIdentity() == rhs.ice_getIdentity() + return cmp(lhs.ice_getIdentity(), rhs.ice_getIdentity()) def proxyIdentityAndFacetEqual(lhs, rhs): + return proxyIdentityAndFacetCompare(lhs, rhs) == 0 + +def proxyIdentityAndFacetCompare(lhs, rhs): if (lhs and not isinstance(lhs, ObjectPrx)) or (rhs and not isinstance(rhs, ObjectPrx)): raise ValueError('argument is not a proxy') if not lhs and not rhs: return True elif not lhs and rhs: - return False + return -1 elif lhs and not rhs: - return False + return 1 + elif lhs.ice_getIdentity() != rhs.ice_getIdentity(): + return cmp(lhs.ice_getIdentity(), rhs.ice_getIdentity()) else: - return lhs.ice_getIdentity() == rhs.ice_getIdentity() and lhs.ice_getFacet() == rhs.ice_getFacet() + return cmp(lhs.ice_getFacet(), rhs.ice_getFacet()) |