2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-15 07:43:26 +00:00

Adding an AttributePolicy system

This change adds a policy system that will be used by the KmipEngine to
track and organize rules for individual KMIP attributes. Comparison
operators for the Integer primitive and ProtocolVersion struct are added
to support the AttributePolicy. Tests for all new changes are included.
This commit is contained in:
Peter
2016-03-18 12:46:40 -04:00
parent 9e074da553
commit 07a63c07c8
6 changed files with 1568 additions and 2 deletions

View File

@@ -231,10 +231,10 @@ class Integer(Base):
raise ValueError('integer value less than accepted min')
def __repr__(self):
return "{0}(value={1})".format(type(self).__name__, repr(self.value))
return "{0}(value={1})".format(type(self).__name__, self.value)
def __str__(self):
return "{0}".format(repr(self.value))
return str(self.value)
def __eq__(self, other):
if isinstance(other, Integer):
@@ -248,6 +248,30 @@ class Integer(Base):
else:
return NotImplemented
def __lt__(self, other):
if isinstance(other, Integer):
return self.value < other.value
else:
return NotImplemented
def __gt__(self, other):
if isinstance(other, Integer):
return self.value > other.value
else:
return NotImplemented
def __le__(self, other):
if isinstance(other, Integer):
return self.__eq__(other) or self.__lt__(other)
else:
return NotImplemented
def __ge__(self, other):
if isinstance(other, Integer):
return self.__eq__(other) or self.__gt__(other)
else:
return NotImplemented
class LongInteger(Base):
"""