Fix #1360806 [{author_sort} ignored (when saving and in plugboards) when book has no author](https://bugs.launchpad.net/calibre/+bug/1360806)

Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
Kovid Goyal 2014-08-24 22:46:41 +05:30
commit 3c71dfb65f

View File

@ -466,12 +466,20 @@ class Metadata(object):
if v not in (None, NULL_VALUES.get(attr, None)):
setattr(dest, attr, copy.deepcopy(v))
if other.title and other.title != _('Unknown'):
unknown = _('Unknown')
if other.title and other.title != unknown:
self.title = other.title
if hasattr(other, 'title_sort'):
self.title_sort = other.title_sort
if other.authors and other.authors[0] != _('Unknown'):
if other.authors and (
other.authors[0] != unknown or (
not self.authors or (
len(self.authors) == 1 and self.authors[0] == unknown and
getattr(self, 'author_sort', None) == unknown
)
)
):
self.authors = list(other.authors)
if hasattr(other, 'author_sort_map'):
self.author_sort_map = dict(other.author_sort_map)