mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fixes for authors link stuff.
This commit is contained in:
parent
4b64056e5b
commit
7da2a25617
@ -130,15 +130,16 @@ def render_data(mi, use_roman_numbers=True, all_fields=False):
|
|||||||
if mi.author_link_map[aut]:
|
if mi.author_link_map[aut]:
|
||||||
link = mi.author_link_map[aut]
|
link = mi.author_link_map[aut]
|
||||||
elif gprefs.get('default_author_link'):
|
elif gprefs.get('default_author_link'):
|
||||||
vals = {'author': aut}
|
vals = {'author': aut.replace(' ', '+')}
|
||||||
try:
|
try:
|
||||||
vals['author_sort'] = mi.author_sort_map[aut]
|
vals['author_sort'] = mi.author_sort_map[aut].replace(' ', '+')
|
||||||
except:
|
except:
|
||||||
vals['author_sort'] = aut
|
vals['author_sort'] = aut.replace(' ', '+')
|
||||||
link = formatter.safe_format(
|
link = formatter.safe_format(
|
||||||
gprefs.get('default_author_link'), vals, '', vals)
|
gprefs.get('default_author_link'), vals, '', vals)
|
||||||
if link:
|
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:
|
else:
|
||||||
authors.append(aut)
|
authors.append(aut)
|
||||||
ans.append((field, u'<td class="title">%s</td><td>%s</td>'%(name,
|
ans.append((field, u'<td class="title">%s</td><td>%s</td>'%(name,
|
||||||
|
@ -270,12 +270,14 @@ class TagBrowserMixin(object): # {{{
|
|||||||
editor = EditAuthorsDialog(parent, db, id, select_sort)
|
editor = EditAuthorsDialog(parent, db, id, select_sort)
|
||||||
d = editor.exec_()
|
d = editor.exec_()
|
||||||
if d:
|
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:
|
if old_author != new_author:
|
||||||
# The id might change if the new author already exists
|
# The id might change if the new author already exists
|
||||||
id = db.rename_author(id, new_author)
|
id = db.rename_author(id, new_author)
|
||||||
db.set_sort_field_for_author(id, unicode(new_sort),
|
db.set_sort_field_for_author(id, unicode(new_sort),
|
||||||
commit=False, notify=False)
|
commit=False, notify=False)
|
||||||
|
db.set_link_field_for_author(id, unicode(new_link),
|
||||||
|
commit=False, notify=False)
|
||||||
db.commit()
|
db.commit()
|
||||||
self.library_view.model().refresh()
|
self.library_view.model().refresh()
|
||||||
self.tags_view.recount()
|
self.tags_view.recount()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user