forked from openlp/openlp
Attempt to fix bug #1154467 by waiting 10ms and retrying the commit
bzr-revno: 2184 Fixes: https://launchpad.net/bugs/1154467
This commit is contained in:
commit
e4a95be2b8
@ -32,9 +32,11 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
import time
|
||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
from sqlalchemy import Column, ForeignKey, or_, Table, types, func
|
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 import class_mapper, mapper, relation
|
||||||
from sqlalchemy.orm.exc import UnmappedClassError
|
from sqlalchemy.orm.exc import UnmappedClassError
|
||||||
|
|
||||||
@ -48,6 +50,7 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
RESERVED_CHARACTERS = u'\\.^$*+?{}[]()'
|
RESERVED_CHARACTERS = u'\\.^$*+?{}[]()'
|
||||||
|
|
||||||
|
|
||||||
class BibleMeta(BaseModel):
|
class BibleMeta(BaseModel):
|
||||||
"""
|
"""
|
||||||
Bible Meta Data
|
Bible Meta Data
|
||||||
@ -257,6 +260,11 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
text=verse_text
|
text=verse_text
|
||||||
)
|
)
|
||||||
self.session.add(verse)
|
self.session.add(verse)
|
||||||
|
try:
|
||||||
|
self.session.commit()
|
||||||
|
except OperationalError:
|
||||||
|
# Wait 10ms and try again.
|
||||||
|
time.sleep(0.01)
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
|
|
||||||
def create_verse(self, book_id, chapter, verse, text):
|
def create_verse(self, book_id, chapter, verse, text):
|
||||||
|
Loading…
Reference in New Issue
Block a user