Change test for date types in tztime/gmtime functions ZTK-1.1
authorThierry Florac <tflorac@ulthar.net>
Wed, 15 May 2013 10:28:22 +0200
branchZTK-1.1
changeset 218 e8bb333bf7c5
parent 217 635b1a1edf16
child 219 777e63427bbb
Change test for date types in tztime/gmtime functions
src/ztfy/utils/timezone/__init__.py
--- a/src/ztfy/utils/timezone/__init__.py	Wed May 15 10:27:05 2013 +0200
+++ b/src/ztfy/utils/timezone/__init__.py	Wed May 15 10:28:22 2013 +0200
@@ -17,7 +17,7 @@
 
 # import standard packages
 import pytz
-from datetime import date
+from datetime import datetime
 
 # import Zope3 interfaces
 from zope.interface.common.idatetime import ITZInfo
@@ -49,7 +49,7 @@
 def tztime(value):
     if not value:
         return None
-    if isinstance(value, date):
+    if not isinstance(value, datetime):
         return value
     if not value.tzinfo:
         value = GMT.localize(value)
@@ -59,7 +59,7 @@
 def gmtime(value):
     if not value:
         return None
-    if isinstance(value, date):
+    if not isinstance(value, datetime):
         return value
     if not value.tzinfo:
         value = GMT.localize(value)