server/sqlutils.py
changeset 11034 75d752e6daf7
parent 11032 38afb7e23c6c
child 11035 0fb100e8385b
equal deleted inserted replaced
11033:63d860a14a17 11034:75d752e6daf7
    27 from logging import getLogger
    27 from logging import getLogger
    28 from datetime import time, datetime, timedelta
    28 from datetime import time, datetime, timedelta
    29 
    29 
    30 from six import string_types, text_type
    30 from six import string_types, text_type
    31 from six.moves import filter
    31 from six.moves import filter
       
    32 
       
    33 from pytz import utc
    32 
    34 
    33 from logilab import database as db, common as lgc
    35 from logilab import database as db, common as lgc
    34 from logilab.common.shellutils import ProgressBar, DummyProgressBar
    36 from logilab.common.shellutils import ProgressBar, DummyProgressBar
    35 from logilab.common.deprecation import deprecated
    37 from logilab.common.deprecation import deprecated
    36 from logilab.common.logging_ext import set_log_methods
    38 from logilab.common.logging_ext import set_log_methods
   501                             value = value.rsplit('.', 1)[0]
   503                             value = value.rsplit('.', 1)[0]
   502                             try:
   504                             try:
   503                                 row[cellindex] = strptime(value, '%Y-%m-%d %H:%M:%S')
   505                                 row[cellindex] = strptime(value, '%Y-%m-%d %H:%M:%S')
   504                             except Exception:
   506                             except Exception:
   505                                 row[cellindex] = strptime(value, '%Y-%m-%d')
   507                                 row[cellindex] = strptime(value, '%Y-%m-%d')
       
   508                             if vtype == 'TZDatetime':
       
   509                                 row[cellindex] = row[cellindex].replace(tzinfo=utc)
   506                         if vtype == 'Time' and isinstance(value, text_type):
   510                         if vtype == 'Time' and isinstance(value, text_type):
   507                             found_date = True
   511                             found_date = True
   508                             try:
   512                             try:
   509                                 row[cellindex] = strptime(value, '%H:%M:%S')
   513                                 row[cellindex] = strptime(value, '%H:%M:%S')
   510                             except Exception:
   514                             except Exception: