From 929089c04bda9466bacf3879ba7020da0c07ca7b Mon Sep 17 00:00:00 2001 From: janonymous Date: Fri, 24 Jul 2015 19:46:14 +0530 Subject: [PATCH] Add __bool__ for classes that implement __nonzero__ __nonzero__ has been renamed to __bool__ in python3.4. So add the __bool__ magic method that will in turn call the existing __nonzero__ method. Change-Id: I3479564c57316733a9c30d97504ceac74771bfd4 --- swift/common/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/swift/common/utils.py b/swift/common/utils.py index 40a5b85232..2e17431643 100644 --- a/swift/common/utils.py +++ b/swift/common/utils.py @@ -769,6 +769,9 @@ class Timestamp(object): def __nonzero__(self): return bool(self.timestamp or self.offset) + def __bool__(self): + return self.__nonzero__() + @property def normal(self): return NORMAL_FORMAT % self.timestamp