[attributs] Suite pas d'AssertionError en comparant un generalizedTimeFormat avec autre chose qu'un unicode ou un generalizedTimeFormat

This commit is contained in:
Valentin Samir 2014-12-02 20:14:06 +01:00
parent 1c24cceb07
commit 12e8103df7

View file

@ -630,7 +630,7 @@ class generalizedTimeFormat(Attr):
return self._stamp == othertime return self._stamp == othertime
elif isinstance(othertime, int): elif isinstance(othertime, int):
return self._stamp == othertime return self._stamp == othertime
elif isinstance(othertime, unicode) or isinstance(othertime, str): elif isinstance(othertime, unicode) or isinstance(othertime, str):
resource = generalizedTimeFormat(othertime, conn=None, Parent=None) resource = generalizedTimeFormat(othertime, conn=None, Parent=None)
return self._stamp == resource._stamp return self._stamp == resource._stamp
else: else:
@ -642,9 +642,15 @@ class generalizedTimeFormat(Attr):
def __lt__(self, othertime): def __lt__(self, othertime):
if isinstance(othertime, generalizedTimeFormat): if isinstance(othertime, generalizedTimeFormat):
return self._stamp < othertime._stamp return self._stamp < othertime._stamp
else: elif isinstance(othertime, float):
return self._stamp < othertime
elif isinstance(othertime, int):
return self._stamp < othertime
elif isinstance(othertime, unicode) or isinstance(othertime, str):
resource = generalizedTimeFormat(othertime, conn=None, Parent=None) resource = generalizedTimeFormat(othertime, conn=None, Parent=None)
return self._stamp < resource._stamp return self._stamp < resource._stamp
else:
return False
def __le__(self, othertime): def __le__(self, othertime):
return not (self > othertime) return not (self > othertime)