Browse files

Add timezone awareness to datetime class.

This is going to break some stuff until I figure out what all needs to
be handled as local or UTC.

This also moves the contents of '' into a separate folder, and
splits it up into several files.
  • Loading branch information...
wagnerrp committed Jul 16, 2012
1 parent 4b4c57e commit 6f637994ba1222a84e58aef256761c598fc4d422
@@ -100,7 +100,7 @@ class DictData( OrdDict ):
lambda x: x,
- lambda x: datetime.fromTimestamp(x),
+ lambda x: datetime.fromTimestamp(x, datetime.UTCTZ()),
lambda x: date(*[int(y) for y in x.split('-')]),
lambda x: datetime.fromRfc(x)]
_inv_trans = [ str,
@@ -168,7 +168,9 @@ def _process(self, data):
data = DictData._process(self, data)
for key, val in self._db.tablefields[self._table].items():
if (val.type == 'datetime') and (data[key] is not None):
- data[key] =[key])
+ data[key] = datetime.fromDatetime(data[key])\
+ .replace(tzinfo=datetime.UTCTZ())\
+ .astimezone(datetime.localTZ())
return data
def _pull(self):
Oops, something went wrong.

0 comments on commit 6f63799

Please sign in to comment.