do not depend on types.StringTypes anymore
[sfa.git] / sfa / util / sfatime.py
index 3500b2b..7435667 100644 (file)
@@ -22,7 +22,6 @@
 #----------------------------------------------------------------------
 from __future__ import print_function
 
-from types import StringTypes
 import time
 import datetime
 import dateutil.parser
@@ -30,6 +29,7 @@ import calendar
 import re
 
 from sfa.util.sfalogging import logger
+from sfa.util.py23 import StringType
 
 SFATIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
 
@@ -55,7 +55,7 @@ For safety this can also handle inputs that are either timestamps, or datetimes
 
     # prepare the input for the checks below by
     # casting strings ('1327098335') to ints
-    if isinstance(input, StringTypes):
+    if isinstance(input, StringType):
         try:
             input = int(input)
         except ValueError:
@@ -70,7 +70,7 @@ For safety this can also handle inputs that are either timestamps, or datetimes
     if isinstance (input, datetime.datetime):
         #logger.info ("argument to utcparse already a datetime - doing nothing")
         return input
-    elif isinstance (input, StringTypes):
+    elif isinstance (input, StringType):
         t = dateutil.parser.parse(input)
         if t.utcoffset() is not None:
             t = t.utcoffset() + t.replace(tzinfo=None)