From 2ce3f49a8fbe80a5c92460f904d4e75761669ff8 Mon Sep 17 00:00:00 2001 From: Lucas Kanashiro Date: Wed, 15 Oct 2014 14:48:40 -0300 Subject: [PATCH] Logged expection in import_email script --- src/super_archives/management/commands/import_emails.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/super_archives/management/commands/import_emails.py b/src/super_archives/management/commands/import_emails.py index b9816a9..d95c70a 100644 --- a/src/super_archives/management/commands/import_emails.py +++ b/src/super_archives/management/commands/import_emails.py @@ -7,6 +7,7 @@ import os import re import sys import mailbox +import logging from optparse import make_option from django.db import transaction @@ -248,7 +249,6 @@ class Command(BaseCommand, object): # This anti-pattern is needed to avoid the transations to # get stuck in case of errors. transaction.rollback() - os.remove(self.lock_file) raise count += 1 @@ -279,8 +279,14 @@ class Command(BaseCommand, object): run_lock = file(self.lock_file, 'w') run_lock.close() - self.import_emails(archives_path, + try: + self.import_emails(archives_path, options.get('all'), options.get('exclude_lists')) + except Exception, e: + logging.except(e) + raise + finally: + os.remove(self.lock_file) os.remove(self.lock_file) -- libgit2 0.21.2