Further fixes

This commit is contained in:
Phill Ridout 2015-02-19 21:24:12 +00:00
parent 75c9391d8e
commit fb20f9243f
3 changed files with 149 additions and 117 deletions

View File

@ -28,9 +28,9 @@ from PyQt4 import QtCore, QtGui
class HistoryComboBox(QtGui.QComboBox):
"""
The :class:`~openlp.core.common.historycombobox.HistoryComboBox` widget emulates the QLineEdit ``returnPressed`` signal
for when the :kbd:`Enter` or :kbd:`Return` keys are pressed, and saves anything that is typed into the edit box into
its list.
The :class:`~openlp.core.common.historycombobox.HistoryComboBox` widget emulates the QLineEdit ``returnPressed``
signal for when the :kbd:`Enter` or :kbd:`Return` keys are pressed, and saves anything that is typed into the edit
box into its list.
"""
returnPressed = QtCore.pyqtSignal()

View File

@ -30,6 +30,7 @@ log = logging.getLogger(__name__)
__version__ = 1
# TODO: When removing an upgrade path the ftw-data needs updating to the minimum supported version
def upgrade_1(session, metadata):
"""
Version 1 upgrade.
@ -38,6 +39,7 @@ def upgrade_1(session, metadata):
"""
metadata_table = metadata.tables['metadata']
# Copy "Version" to "name" ("version" used by upgrade system)
try:
session.execute(insert(metadata_table).values(
key='name',
value=select(
@ -46,7 +48,10 @@ def upgrade_1(session, metadata):
).as_scalar()
))
session.execute(delete(metadata_table).where(metadata_table.c.key == 'Version'))
except:
log.exception('Exception when upgrading Version')
# Copy "Copyright" to "copyright"
try:
session.execute(insert(metadata_table).values(
key='copyright',
value=select(
@ -55,7 +60,10 @@ def upgrade_1(session, metadata):
).as_scalar()
))
session.execute(delete(metadata_table).where(metadata_table.c.key == 'Copyright'))
except:
log.exception('Exception when upgrading Copyright')
# Copy "Permissions" to "permissions"
try:
session.execute(insert(metadata_table).values(
key='permissions',
value=select(
@ -64,7 +72,10 @@ def upgrade_1(session, metadata):
).as_scalar()
))
session.execute(delete(metadata_table).where(metadata_table.c.key == 'Permissions'))
except:
log.exception('Exception when upgrading Permissions')
# Copy "Bookname language" to "book_name_language"
try:
value_count = session.execute(
select(
[func.count(metadata_table.c.value)],
@ -80,7 +91,10 @@ def upgrade_1(session, metadata):
).as_scalar()
))
session.execute(delete(metadata_table).where(metadata_table.c.key == 'Bookname language'))
except:
log.exception('Exception when upgrading Bookname language')
# Copy "download source" to "download_source"
try:
value_count = session.execute(
select(
[func.count(metadata_table.c.value)],
@ -97,7 +111,10 @@ def upgrade_1(session, metadata):
).as_scalar()
))
session.execute(delete(metadata_table).where(metadata_table.c.key == 'download source'))
except:
log.exception('Exception when upgrading download source')
# Copy "download name" to "download_name"
try:
value_count = session.execute(
select(
[func.count(metadata_table.c.value)],
@ -114,7 +131,10 @@ def upgrade_1(session, metadata):
).as_scalar()
))
session.execute(delete(metadata_table).where(metadata_table.c.key == 'download name'))
except:
log.exception('Exception when upgrading download name')
# Copy "proxy server" to "proxy_server"
try:
value_count = session.execute(
select(
[func.count(metadata_table.c.value)],
@ -131,7 +151,10 @@ def upgrade_1(session, metadata):
).as_scalar()
))
session.execute(delete(metadata_table).where(metadata_table.c.key == 'proxy server'))
except:
log.exception('Exception when upgrading proxy server')
# Copy "proxy username" to "proxy_username"
try:
value_count = session.execute(
select(
[func.count(metadata_table.c.value)],
@ -148,7 +171,10 @@ def upgrade_1(session, metadata):
).as_scalar()
))
session.execute(delete(metadata_table).where(metadata_table.c.key == 'proxy username'))
except:
log.exception('Exception when upgrading proxy username')
# Copy "proxy password" to "proxy_password"
try:
value_count = session.execute(
select(
[func.count(metadata_table.c.value)],
@ -165,5 +191,10 @@ def upgrade_1(session, metadata):
).as_scalar()
))
session.execute(delete(metadata_table).where(metadata_table.c.key == 'proxy password'))
except:
log.exception('Exception when upgrading proxy password')
try:
session.execute(delete(metadata_table).where(metadata_table.c.key == 'dbversion'))
except:
log.exception('Exception when deleting dbversion')
session.commit()

View File

@ -35,6 +35,7 @@ log = logging.getLogger(__name__)
__version__ = 4
# TODO: When removing an upgrade path the ftw-data needs updating to the minimum supported version
def upgrade_1(session, metadata):
"""
Version 1 upgrade.