From 08903ab18766363699025e2157f8e95b23d8b640 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Tue, 2 Dec 2014 01:57:48 +0100 Subject: [PATCH] [attributs] Pas d'AssertionError en comparant un generalizedTimeFormat avec autre chose qu'un unicode ou un generalizedTimeFormat --- attributs.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/attributs.py b/attributs.py index 502f774..a58de83 100644 --- a/attributs.py +++ b/attributs.py @@ -626,9 +626,15 @@ class generalizedTimeFormat(Attr): def __eq__(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 __neq__(self, othertime): return not (self == othertime)