From dc6c6bec31938fe9f65c90a3419eb0d7ac5916ac Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 16 Mar 2010 22:43:41 +0200 Subject: [PATCH] - Removed commented code (just for you, TRB143!) - Removed any non-alphanumeric character for Bible names, just to be safe, since we don't actually use the filenames anymore. --- openlp/plugins/bibles/lib/db.py | 9 +-------- openlp/plugins/bibles/lib/manager.py | 3 --- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 08c6cbe38..8f55fb5fc 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -106,9 +106,7 @@ class BibleDB(QtCore.QObject): def clean_filename(self, old_filename): if not isinstance(old_filename, unicode): old_filename = unicode(old_filename, u'utf-8') - for char in [u'\\', u'/', u':', u'*', u'?', u'"', u'<', u'>', u'|', u' ']: - old_filename = old_filename.replace(char, u'_') - old_filename = re.sub(r'[_]+', u'_', old_filename).strip(u'_') + old_filename = re.sub(r'[^\w]+', u'_', old_filename).strip(u'_') return old_filename + u'.sqlite' def register(self, wizard): @@ -266,8 +264,6 @@ class BibleDB(QtCore.QObject): count = self.session.query(Verse.chapter).join(Book)\ .filter(Book.name==book)\ .distinct().count() - #verse = self.session.query(Verse).join(Book).filter( - # Book.name == bookname).order_by(Verse.chapter.desc()).first() if not count: return 0 else: @@ -279,9 +275,6 @@ class BibleDB(QtCore.QObject): .filter(Book.name==book)\ .filter(Verse.chapter==chapter)\ .count() - #verse = self.session.query(Verse).join(Book).filter( - # Book.name == bookname).filter( - # Verse.chapter == chapter).order_by(Verse.verse.desc()).first() if not count: return 0 else: diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 12b4eeec8..90401a3e1 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -125,8 +125,6 @@ class BibleManager(object): for filename in files: bible = BibleDB(self.parent, path=self.path, file=filename, config=self.config) - #self.db_cache[name] = BibleDB(self.parent, path=self.path, - # name=name, config=self.config) name = bible.get_name() log.debug(u'Bible Name: "%s"', name) self.db_cache[name] = bible @@ -140,7 +138,6 @@ class BibleManager(object): download_source=source.value, download_name=download_name) if meta_proxy: web_bible.set_proxy_server(meta_proxy.value) - #del self.db_cache[name] self.db_cache[name] = web_bible log.debug(u'Bibles reloaded')