Fix bug 1154467

This commit is contained in:
Samuel Mehrbrodt 2014-04-10 21:45:49 +02:00
parent 5e9d9a3cd0
commit 056a7b72ed

View File

@ -32,9 +32,11 @@ import logging
import os
import re
import sqlite3
import time
from PyQt4 import QtCore
from sqlalchemy import Column, ForeignKey, Table, or_, types, func
from sqlalchemy.exc import OperationalError
from sqlalchemy.orm import class_mapper, mapper, relation
from sqlalchemy.orm.exc import UnmappedClassError
@ -235,7 +237,12 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
text=verse_text
)
self.session.add(verse)
self.session.commit()
try:
self.session.commit()
except OperationalError:
# Wait 10ms and try again.
time.sleep(0.01)
self.session.commit()
def create_verse(self, book_id, chapter, verse, text):
"""