forked from openlp/openlp
head
This commit is contained in:
commit
13cf482495
@ -85,11 +85,13 @@ def upgrade_db(url, upgrade):
|
||||
Provides a class for the metadata table.
|
||||
"""
|
||||
pass
|
||||
load_changes = True
|
||||
load_changes = False
|
||||
tables = []
|
||||
try:
|
||||
tables = upgrade.upgrade_setup(metadata)
|
||||
load_changes = True
|
||||
except (SQLAlchemyError, DBAPIError):
|
||||
load_changes = False
|
||||
pass
|
||||
metadata_table = Table(u'metadata', metadata,
|
||||
Column(u'key', types.Unicode(64), primary_key=True),
|
||||
Column(u'value', types.UnicodeText(), default=None)
|
||||
@ -99,6 +101,7 @@ def upgrade_db(url, upgrade):
|
||||
version_meta = session.query(Metadata).get(u'version')
|
||||
if version_meta is None:
|
||||
version_meta = Metadata.populate(key=u'version', value=u'0')
|
||||
session.add(version_meta)
|
||||
version = 0
|
||||
else:
|
||||
version = int(version_meta.value)
|
||||
@ -111,16 +114,16 @@ def upgrade_db(url, upgrade):
|
||||
try:
|
||||
getattr(upgrade, u'upgrade_%d' % version) \
|
||||
(session, metadata, tables)
|
||||
version_meta.value = unicode(version)
|
||||
except (SQLAlchemyError, DBAPIError):
|
||||
log.exception(u'Could not run database upgrade script '
|
||||
'"upgrade_%s", upgrade process has been halted.', version)
|
||||
break
|
||||
version_meta.value = unicode(version)
|
||||
session.commit()
|
||||
version += 1
|
||||
else:
|
||||
version_meta = Metadata.populate(key=u'version',
|
||||
value=int(upgrade.__version__))
|
||||
session.add(version_meta)
|
||||
session.commit()
|
||||
return int(version_meta.value), upgrade.__version__
|
||||
|
||||
|
@ -109,7 +109,7 @@ class Ui_AboutDialog(object):
|
||||
contributors = [u'Gerald "jerryb" Britton',
|
||||
u'Samuel "MrGamgee" Findlay', u'Scott "sguerrieri" Guerrieri',
|
||||
u'Matthias "matthub" Hub', u'Meinert "m2j" Jordan',
|
||||
u'Armin "orangeshirt" K\xf6hler', u'Eric "luen" Ludin',
|
||||
u'Armin "orangeshirt" K\xf6hler', u'Erik "luen" Lundin',
|
||||
u'Edwin "edwinlunando" Lunando', u'Brian "brianmeyer" Meyer',
|
||||
u'Joshua "milleja46" Miller', u'Stevan "ElderP" Pettit',
|
||||
u'Mattias "mahfiaz" P\xf5ldaru', u'Christian "crichter" Richter',
|
||||
@ -149,7 +149,7 @@ class Ui_AboutDialog(object):
|
||||
u'Gustavo Bim', u'Rog\xeanio Bel\xe9m', u'Samuel'
|
||||
u'Simon "samscudder" Scudder', u'Van Der Fran'],
|
||||
u'ru': [u'Sergey "ratz" Ratz'],
|
||||
u'sv': [u'Eric "luen" Ludin']
|
||||
u'sv': [u'Erik "luen" Lundin']
|
||||
}
|
||||
documentors = [u'Wesley "wrst" Stout',
|
||||
u'John "jseagull1" Cegalis (lead)']
|
||||
|
@ -279,14 +279,8 @@ class BGExtract(object):
|
||||
page_source = unicode(page_source, u'utf8')
|
||||
except UnicodeDecodeError:
|
||||
page_source = unicode(page_source, u'cp1251')
|
||||
page_source_temp = re.search(u'<table .*?class="infotable".*?>.*?'\
|
||||
u'</table>', page_source, re.DOTALL)
|
||||
if page_source_temp:
|
||||
soup = page_source_temp.group(0)
|
||||
else:
|
||||
soup = None
|
||||
try:
|
||||
soup = BeautifulSoup(soup)
|
||||
soup = BeautifulSoup(page_source)
|
||||
except HTMLParseError:
|
||||
log.error(u'BeautifulSoup could not parse the Bible page.')
|
||||
send_error_message(u'parse')
|
||||
@ -295,7 +289,8 @@ class BGExtract(object):
|
||||
send_error_message(u'parse')
|
||||
return None
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
content = soup.find(u'table', {u'class': u'infotable'})
|
||||
content = soup.find(u'table', u'infotable')
|
||||
if content:
|
||||
content = content.findAll(u'tr')
|
||||
if not content:
|
||||
log.error(u'No books found in the Biblegateway response.')
|
||||
|
Loading…
Reference in New Issue
Block a user