From cf2067fb618af33f3a715d9381d47c5c24b7be01 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 11 Mar 2009 06:39:11 +0000 Subject: [PATCH] Fix Custom plugin to add it self to config if not present. Correct spacing error in code. bzr-revno: 407 --- openlp/plugins/bibles/lib/bibleCSVimpl.py | 1 - openlp/plugins/custom/lib/manager.py | 26 +++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/openlp/plugins/bibles/lib/bibleCSVimpl.py b/openlp/plugins/bibles/lib/bibleCSVimpl.py index fb2c75b00..c4a2b1e7f 100644 --- a/openlp/plugins/bibles/lib/bibleCSVimpl.py +++ b/openlp/plugins/bibles/lib/bibleCSVimpl.py @@ -43,7 +43,6 @@ class BibleCSVImpl(BibleCommon): #Populate the Tables fbooks=open(booksfile, 'r') fverse=open(versesfile, 'r') - count = 0 for line in fbooks: diff --git a/openlp/plugins/custom/lib/manager.py b/openlp/plugins/custom/lib/manager.py index ff11fcce5..46ea275ae 100644 --- a/openlp/plugins/custom/lib/manager.py +++ b/openlp/plugins/custom/lib/manager.py @@ -45,19 +45,19 @@ class CustomManager(): self.config = config log.debug('Custom Initialising') self.db_url = u'' -# db_type = self.config.get_config(u'db type') -# if db_type == u'sqlite': -# self.db_url = u'sqlite:///' + self.config.get_data_path() + \ -# u'/custom.sqlite' -# else: -# self.db_url = u'%s://%s:%s@%s/%s' % \ -# (db_type, self.config.get_config(u'db username'), -# self.config.get_config(u'db password'), -# self.config.get_config(u'db hostname'), -# self.config.get_config(u'db database')) -# self.session = init_models(self.db_url) -# if not custom_slide_table.exists(): -# metadata.create_all() + db_type = self.config.get_config(u'db type', u'sqlite') + if db_type == u'sqlite': + self.db_url = u'sqlite:///' + self.config.get_data_path() + \ + u'/custom.sqlite' + else: + self.db_url = u'%s://%s:%s@%s/%s' % \ + (db_type, self.config.get_config(u'db username'), + self.config.get_config(u'db password'), + self.config.get_config(u'db hostname'), + self.config.get_config(u'db database')) + self.session = init_models(self.db_url) + if not custom_slide_table.exists(): + metadata.create_all() log.debug('Custom Initialised') #