summaryrefslogtreecommitdiffstats
path: root/to_sqldb.py
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2012-08-17 15:57:41 +0200
committerAurélien Bompard <aurelien@bompard.org>2012-09-07 10:40:54 +0200
commit4051981f32379b673c5ef2c50962d05570b91204 (patch)
tree50beecf8edc41d6814fe3ba5f6345a87c4143ce5 /to_sqldb.py
parentf2c53282e819fe935911466dd873034ebcde9d02 (diff)
downloadkittystore-4051981f32379b673c5ef2c50962d05570b91204.tar.gz
kittystore-4051981f32379b673c5ef2c50962d05570b91204.tar.xz
kittystore-4051981f32379b673c5ef2c50962d05570b91204.zip
Fix some bugs in the import code
and add unit tests for these cases.
Diffstat (limited to 'to_sqldb.py')
-rw-r--r--to_sqldb.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/to_sqldb.py b/to_sqldb.py
index 1d6576a..4afa8af 100644
--- a/to_sqldb.py
+++ b/to_sqldb.py
@@ -44,7 +44,12 @@ def to_db(mbfile, list_name, store):
cnt_read = cnt_read + 1
#print cnt_read
TOTALCNT = TOTALCNT + 1
- msg_id_hash = store.add_to_list(list_name, message)
+ try:
+ msg_id_hash = store.add_to_list(list_name, message)
+ except ValueError, e:
+ print "%s from %s about %s" % (e.args[0],
+ e.args[1].get("From"), e.args[1].get("Subject"))
+ continue
store.session.flush()
cnt = cnt + 1
store.session.commit()