transform working in parent process

This commit is contained in:
fawce
2012-01-17 16:18:15 -05:00
parent ae935b2242
commit 7ae60c7f7d
3 changed files with 29 additions and 15 deletions
+5 -1
View File
@@ -2,6 +2,9 @@
Small classes to assist with db access, timezone calculations, and so on.
"""
import datetime
import pytz
class DocWrap():
"""
Provides attribute access style on top of dictionary results from pymongo.
@@ -38,7 +41,8 @@ def parse_date(dt_str):
"""parse strings according to the same format as generated by format_date"""
if(dt_str == None):
return None
dt = datetime.datetime.strptime(dt_str(".")[0], '%Y/%m/%d-%H:%M:%S').replace(microsecond=int(dt_str(".")[1]+"000")).replace(tzinfo = pytz.utc)
parts = dt_str.split(".")
dt = datetime.datetime.strptime(parts[0], '%Y/%m/%d-%H:%M:%S').replace(microsecond=int(parts[1]+"000")).replace(tzinfo = pytz.utc)
return dt
def format_date(dt):