From 12e8103df72868acdf8de487f95cd894027edaa1 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Tue, 2 Dec 2014 20:14:06 +0100 Subject: [PATCH] [attributs] Suite pas d'AssertionError en comparant un generalizedTimeFormat avec autre chose qu'un unicode ou un generalizedTimeFormat --- attributs.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/attributs.py b/attributs.py index c8f43fd..f2be07d 100644 --- a/attributs.py +++ b/attributs.py @@ -630,7 +630,7 @@ class generalizedTimeFormat(Attr): return self._stamp == othertime elif isinstance(othertime, int): 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) return self._stamp == resource._stamp else: @@ -642,9 +642,15 @@ class generalizedTimeFormat(Attr): def __lt__(self, othertime): if isinstance(othertime, generalizedTimeFormat): 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) return self._stamp < resource._stamp + else: + return False def __le__(self, othertime): return not (self > othertime)