summaryrefslogtreecommitdiffstats
path: root/kittystore
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2012-11-17 11:51:14 +0100
committerAurélien Bompard <aurelien@bompard.org>2012-11-17 11:51:14 +0100
commit4d8637021a884a2e7e6debf78cbf71cbca3771a3 (patch)
tree6bda132342633e9315980935b59c79b9218917cd /kittystore
parent8666f5d37daf5789300f944fe7445db16d575822 (diff)
downloadkittystore-4d8637021a884a2e7e6debf78cbf71cbca3771a3.tar.gz
kittystore-4d8637021a884a2e7e6debf78cbf71cbca3771a3.tar.xz
kittystore-4d8637021a884a2e7e6debf78cbf71cbca3771a3.zip
Handle dates without time zones
Diffstat (limited to 'kittystore')
-rw-r--r--kittystore/storm/store.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/kittystore/storm/store.py b/kittystore/storm/store.py
index 75983d8..6e6df84 100644
--- a/kittystore/storm/store.py
+++ b/kittystore/storm/store.py
@@ -120,8 +120,10 @@ class StormStore(object):
msg_date = parsedate(message.get("Date"))
if msg_date is None:
# Absent or unparseable date
- email.date = datetime.datetime.now()
- email.date = msg_date.astimezone(tzutc()).replace(tzinfo=None)
+ msg_date = datetime.datetime.now()
+ if msg_date.tzinfo is not None:
+ msg_date = msg_date.astimezone(tzutc()).replace(tzinfo=None)
+ email.date = msg_date
utcoffset = msg_date.utcoffset()
if utcoffset is None:
email.timezone = 0