← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/bug-1154467-2.0 into lp:openlp/2.0

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-1154467-2.0 into lp:openlp/2.0.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1154467 in OpenLP: "Web download bible db's getting locked"
  https://bugs.launchpad.net/openlp/+bug/1154467

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-1154467-2.0/+merge/199904

Attempt to fix bug #1154467 by retrying the commit if it fails
-- 
https://code.launchpad.net/~raoul-snyman/openlp/bug-1154467-2.0/+merge/199904
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/bug-1154467-2.0 into lp:openlp/2.0.
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py	2013-08-21 12:47:32 +0000
+++ openlp/plugins/bibles/lib/db.py	2013-12-21 22:57:40 +0000
@@ -35,6 +35,7 @@
 
 from PyQt4 import QtCore
 from sqlalchemy import Column, ForeignKey, or_, Table, types, func
+from sqlalchemy.exc import OperationalError
 from sqlalchemy.orm import class_mapper, mapper, relation
 from sqlalchemy.orm.exc import UnmappedClassError
 
@@ -48,6 +49,7 @@
 
 RESERVED_CHARACTERS = u'\\.^$*+?{}[]()'
 
+
 class BibleMeta(BaseModel):
     """
     Bible Meta Data
@@ -257,7 +259,11 @@
                 text=verse_text
             )
             self.session.add(verse)
-        self.session.commit()
+        try:
+            self.session.commit()
+        except OperationalError:
+            # Try again. If it fails again, let the exception happen
+            self.session.commit()
 
     def create_verse(self, book_id, chapter, verse, text):
         """
@@ -363,7 +369,7 @@
 
         ``book``
             The name of the book, according to the selected language.
-        
+
         ``language_selection``
             The language selection the user has chosen in the settings
             section of the Bible.


Follow ups