diff options
author | Rob Austein <sra@hactrn.net> | 2009-07-05 19:59:38 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2009-07-05 19:59:38 +0000 |
commit | d4ad68e3109bb0229fea4fd23fcefa10c2daf18a (patch) | |
tree | 387ed3f41d6638adb8f0c4a3a463fb21cdee9717 | |
parent | 24456ef87767a47aa7412d9e0c8398e6ae1fb096 (diff) |
Extend DER_object__cmp__() to handle None objects.
svn path=/rpkid/rpki/x509.py; revision=2578
-rw-r--r-- | rpkid/rpki/x509.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/rpkid/rpki/x509.py b/rpkid/rpki/x509.py index 4cff5d05..540209d0 100644 --- a/rpkid/rpki/x509.py +++ b/rpkid/rpki/x509.py @@ -197,8 +197,17 @@ class DER_object(object): return self.pem_converter.to_PEM(self.get_DER()) def __cmp__(self, other): - """Compare two DER-encoded objects.""" - return cmp(self.get_DER(), other.get_DER()) + """ + Compare two DER-encoded objects. + """ + if self is None and other is None: + return 0 + elif self is None: + return -1 + elif other is None: + return 1 + else: + return cmp(self.get_DER(), other.get_DER()) def hSKI(self): """ |