Remove the db_file_path option from db.Manager init function

This commit is contained in:
Martin Zibricky 2011-09-11 22:39:33 +02:00
parent 606e19734c
commit 50e1964795
1 changed files with 2 additions and 10 deletions

View File

@ -159,7 +159,7 @@ class Manager(object):
Provide generic object persistence management Provide generic object persistence management
""" """
def __init__(self, plugin_name, init_schema, db_file_name=None, def __init__(self, plugin_name, init_schema, db_file_name=None,
db_file_path=None, upgrade_mod=None): upgrade_mod=None):
""" """
Runs the initialisation process that includes creating the connection Runs the initialisation process that includes creating the connection
to the database and the tables if they don't exist. to the database and the tables if they don't exist.
@ -176,10 +176,6 @@ class Manager(object):
``db_file_name`` ``db_file_name``
The file name to use for this database. Defaults to None resulting The file name to use for this database. Defaults to None resulting
in the plugin_name being used. in the plugin_name being used.
``db_file_path``
The path to sqlite file to use for this database. This is useful
for testing purposes.
""" """
settings = QtCore.QSettings() settings = QtCore.QSettings()
settings.beginGroup(plugin_name) settings.beginGroup(plugin_name)
@ -188,11 +184,7 @@ class Manager(object):
db_type = unicode( db_type = unicode(
settings.value(u'db type', QtCore.QVariant(u'sqlite')).toString()) settings.value(u'db type', QtCore.QVariant(u'sqlite')).toString())
if db_type == u'sqlite': if db_type == u'sqlite':
# For automated tests we need to supply file_path directly if db_file_name:
if db_file_path:
self.db_url = u'sqlite:///%s' % os.path.normpath(
os.path.abspath(db_file_path))
elif db_file_name:
self.db_url = u'sqlite:///%s/%s' % ( self.db_url = u'sqlite:///%s/%s' % (
AppLocation.get_section_data_path(plugin_name), AppLocation.get_section_data_path(plugin_name),
db_file_name) db_file_name)