From 66369dadea1fccfc8cda844b023296845ad15fe5 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Sun, 26 Feb 2012 17:26:52 +0000 Subject: Revert "wip:flush" This reverts commit 39f74fdd0f4a4e6f4a12765217fdf9b56fb5c189. ..which was accidentally pushed to testing --- alot/db.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/alot/db.py b/alot/db.py index e6f2c649..44ca608d 100644 --- a/alot/db.py +++ b/alot/db.py @@ -86,6 +86,12 @@ class DBManager(object): if self.ro: raise DatabaseROError() if self.writequeue: + # aquire a writeable db handler + try: + mode = Database.MODE.READ_WRITE + db = Database(path=self.path, mode=mode) + except NotmuchError: + raise DatabaseLockedError() # read notmuch's config regarding imap flag synchronization sync = settings.get_notmuch_setting('maildir', 'synchronize_flags') @@ -98,13 +104,6 @@ class DBManager(object): # watch out for notmuch errors to re-insert current_item # to the queue on errors try: - # aquire a writeable db handler - try: - mode = Database.MODE.READ_WRITE - db = Database(path=self.path, mode=mode) - except NotmuchError: - raise DatabaseLockedError() - # the first two coordinants are cnmdname and post-callback cmd, afterwards = current_item[:2] @@ -149,8 +148,6 @@ class DBManager(object): if db.end_atomic() != notmuch.STATUS.SUCCESS: raise DatabaseError('fail-status from end_atomic') - # close db - db.close() # call post-callback if callable(afterwards): afterwards() -- cgit v1.2.3