summaryrefslogtreecommitdiffstats
path: root/kittystore/storm
diff options
context:
space:
mode:
Diffstat (limited to 'kittystore/storm')
-rw-r--r--kittystore/storm/__init__.py2
-rw-r--r--kittystore/storm/store.py8
2 files changed, 7 insertions, 3 deletions
diff --git a/kittystore/storm/__init__.py b/kittystore/storm/__init__.py
index da1a56d..b7c7a92 100644
--- a/kittystore/storm/__init__.py
+++ b/kittystore/storm/__init__.py
@@ -39,8 +39,8 @@ def create_store(url, debug):
if debug:
storm.tracer.debug(True, stream=sys.stdout)
database = create_database(url)
- store = Store(database)
dbtype = url.partition(":")[0]
+ store = Store(database)
dbschema = Schema(schema.CREATES[dbtype], [], [], schema)
dbschema.upgrade(store)
return StormStore(store, debug)
diff --git a/kittystore/storm/store.py b/kittystore/storm/store.py
index 6e6df84..272907b 100644
--- a/kittystore/storm/store.py
+++ b/kittystore/storm/store.py
@@ -115,8 +115,6 @@ class StormStore(object):
email.sender_email = unicode(from_email).strip()
email.subject = header_to_unicode(message.get('Subject'))
email.full = message.as_string() # Before scrubbing
- scrubber = Scrubber(list_name, message, self)
- email.content = scrubber.scrub() # warning: modifies the msg in-place
msg_date = parsedate(message.get("Date"))
if msg_date is None:
# Absent or unparseable date
@@ -132,6 +130,10 @@ class StormStore(object):
email.timezone = ( (utcoffset.days * 24 * 60 * 60)
+ utcoffset.seconds) / 60
+ scrubber = Scrubber(list_name, message)
+ # warning: scrubbing modifies the msg in-place
+ email.content, attachments = scrubber.scrub()
+
#category = 'Question' # TODO: enum + i18n ?
#if ('agenda' in message.get('Subject', '').lower() or
# 'reminder' in message.get('Subject', '').lower()):
@@ -150,6 +152,8 @@ class StormStore(object):
self.db.add(email)
self.flush()
+ for attachment in attachments:
+ self.add_attachment(list_name, msg_id, *attachment)
return email.message_id_hash
def delete_message(self, message_id):