- 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.
This commit is contained in:
Raoul Snyman 2010-03-16 22:43:41 +02:00
parent c63c09017e
commit dc6c6bec31
2 changed files with 1 additions and 11 deletions

View File

@ -106,9 +106,7 @@ class BibleDB(QtCore.QObject):
def clean_filename(self, old_filename): def clean_filename(self, old_filename):
if not isinstance(old_filename, unicode): if not isinstance(old_filename, unicode):
old_filename = unicode(old_filename, u'utf-8') old_filename = unicode(old_filename, u'utf-8')
for char in [u'\\', u'/', u':', u'*', u'?', u'"', u'<', u'>', u'|', u' ']: old_filename = re.sub(r'[^\w]+', u'_', old_filename).strip(u'_')
old_filename = old_filename.replace(char, u'_')
old_filename = re.sub(r'[_]+', u'_', old_filename).strip(u'_')
return old_filename + u'.sqlite' return old_filename + u'.sqlite'
def register(self, wizard): def register(self, wizard):
@ -266,8 +264,6 @@ class BibleDB(QtCore.QObject):
count = self.session.query(Verse.chapter).join(Book)\ count = self.session.query(Verse.chapter).join(Book)\
.filter(Book.name==book)\ .filter(Book.name==book)\
.distinct().count() .distinct().count()
#verse = self.session.query(Verse).join(Book).filter(
# Book.name == bookname).order_by(Verse.chapter.desc()).first()
if not count: if not count:
return 0 return 0
else: else:
@ -279,9 +275,6 @@ class BibleDB(QtCore.QObject):
.filter(Book.name==book)\ .filter(Book.name==book)\
.filter(Verse.chapter==chapter)\ .filter(Verse.chapter==chapter)\
.count() .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: if not count:
return 0 return 0
else: else:

View File

@ -125,8 +125,6 @@ class BibleManager(object):
for filename in files: for filename in files:
bible = BibleDB(self.parent, path=self.path, file=filename, bible = BibleDB(self.parent, path=self.path, file=filename,
config=self.config) config=self.config)
#self.db_cache[name] = BibleDB(self.parent, path=self.path,
# name=name, config=self.config)
name = bible.get_name() name = bible.get_name()
log.debug(u'Bible Name: "%s"', name) log.debug(u'Bible Name: "%s"', name)
self.db_cache[name] = bible self.db_cache[name] = bible
@ -140,7 +138,6 @@ class BibleManager(object):
download_source=source.value, download_name=download_name) download_source=source.value, download_name=download_name)
if meta_proxy: if meta_proxy:
web_bible.set_proxy_server(meta_proxy.value) web_bible.set_proxy_server(meta_proxy.value)
#del self.db_cache[name]
self.db_cache[name] = web_bible self.db_cache[name] = web_bible
log.debug(u'Bibles reloaded') log.debug(u'Bibles reloaded')