diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 3def6bc3e..a638040fb 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -35,6 +35,7 @@ import sqlite3 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 @@ log = logging.getLogger(__name__) RESERVED_CHARACTERS = u'\\.^$*+?{}[]()' + class BibleMeta(BaseModel): """ Bible Meta Data @@ -257,7 +259,11 @@ class BibleDB(QtCore.QObject, Manager): 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 @@ class BibleDB(QtCore.QObject, Manager): ``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.