Fixes for authors link stuff.

This commit is contained in:
Charles Haley 2011-06-28 21:08:37 +01:00
parent 4b64056e5b
commit 7da2a25617
2 changed files with 8 additions and 5 deletions

View File

@ -130,15 +130,16 @@ def render_data(mi, use_roman_numbers=True, all_fields=False):
if mi.author_link_map[aut]:
link = mi.author_link_map[aut]
elif gprefs.get('default_author_link'):
vals = {'author': aut}
vals = {'author': aut.replace(' ', '+')}
try:
vals['author_sort'] = mi.author_sort_map[aut]
vals['author_sort'] = mi.author_sort_map[aut].replace(' ', '+')
except:
vals['author_sort'] = aut
vals['author_sort'] = aut.replace(' ', '+')
link = formatter.safe_format(
gprefs.get('default_author_link'), vals, '', vals)
if link:
authors.append(u'<a href="%s">%s</a>'%(urllib2.quote(link), aut))
link = prepare_string_for_xml(link)
authors.append(u'<a href="%s">%s</a>'%(link, aut))
else:
authors.append(aut)
ans.append((field, u'<td class="title">%s</td><td>%s</td>'%(name,

View File

@ -270,12 +270,14 @@ class TagBrowserMixin(object): # {{{
editor = EditAuthorsDialog(parent, db, id, select_sort)
d = editor.exec_()
if d:
for (id, old_author, new_author, new_sort) in editor.result:
for (id, old_author, new_author, new_sort, new_link) in editor.result:
if old_author != new_author:
# The id might change if the new author already exists
id = db.rename_author(id, new_author)
db.set_sort_field_for_author(id, unicode(new_sort),
commit=False, notify=False)
db.set_link_field_for_author(id, unicode(new_link),
commit=False, notify=False)
db.commit()
self.library_view.model().refresh()
self.tags_view.recount()