add timezone support to DateTime

Bug #280708 reported by Markus Korn
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

storing of datetime objects with timezone information does not work, as an example see the attached script which fails with an ValueError:

Traceback (most recent call last):
  File "", line 49, in <module>
    print [ for i in]
  File "/usr/lib/python2.5/site-packages/storm/", line 917, in __iter__
    yield self._load_objects(result, values)
  File "/usr/lib/python2.5/site-packages/storm/", line 910, in _load_objects
    return self._store._load_objects(self._cls_spec_info, result, values)
  File "/usr/lib/python2.5/site-packages/storm/", line 608, in _load_objects
    return self._load_object(cls_spec_info, result, values)
  File "/usr/lib/python2.5/site-packages/storm/", line 666, in _load_object
    self._set_values(obj_info, cls_info.columns, result, values)
  File "/usr/lib/python2.5/site-packages/storm/", line 721, in _set_values
    result.set_variable(variable, value)
  File "/usr/lib/python2.5/site-packages/storm/databases/", line 83, in set_variable
    variable.set(value, from_db=True)
  File "/usr/lib/python2.5/site-packages/storm/", line 192, in set
    new_value = self.parse_set(value, from_db)
  File "/usr/lib/python2.5/site-packages/storm/", line 391, in parse_set
  File "/usr/lib/python2.5/site-packages/storm/", line 578, in _parse_time
    raise ValueError("Unknown time format: %r" % time_str)
ValueError: Unknown time format: u'12:30:40+00:00'


Revision history for this message
Markus Korn (thekorn) wrote :
Revision history for this message
Markus Korn (thekorn) wrote :

I worked around it by subclassing DateTime, maybe this helps you fixing this issue

Revision history for this message
Barry Warsaw (barry) wrote :

I'm hitting this in Mailman 3 now because I'm creating all my datetime objects with a UTC timezone. This adds the +00:00 suffix onto the str format, breaking DateTime as you see above. At the very least, UTC timezones should be supported directly.

Revision history for this message
Barry Warsaw (barry) wrote :

Markus, can you post your subclass? It would be nice not to duplicate the effort with subtle differences.

Revision history for this message
Aurélien Bompard (abompard) wrote :

Barry, the subclass is in the file Markus posted on comment #2.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers