Fix save to disk when author_sort is blank

This commit is contained in:
Kovid Goyal 2007-08-25 20:45:43 +00:00
parent b56166abb8
commit 817461bdfe

View File

@ -1001,12 +1001,14 @@ class LibraryDatabase(object):
id = self.id(index) id = self.id(index)
au = self.conn.execute('SELECT author_sort FROM books WHERE id=?', au = self.conn.execute('SELECT author_sort FROM books WHERE id=?',
(id,)).fetchone()[0] (id,)).fetchone()[0]
if not au:
au = 'Unknown'
if not by_author.has_key(au): if not by_author.has_key(au):
by_author[au] = [] by_author[au] = []
by_author[au].append(index) by_author[au].append(index)
for au in by_author.keys(): for au in by_author.keys():
if au is None: if not au:
au = '' au = 'Unknown'
apath = os.path.join(dir, au) apath = os.path.join(dir, au)
if not os.path.exists(apath): if not os.path.exists(apath):
os.mkdir(apath) os.mkdir(apath)