mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Only copy has_cover and id if they exist
This commit is contained in:
parent
c10a718174
commit
5b17a2431f
@ -7,6 +7,7 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import copy
|
||||
import traceback
|
||||
from contextlib import suppress
|
||||
|
||||
from calibre import prints
|
||||
from calibre.constants import DEBUG
|
||||
@ -232,8 +233,10 @@ class Metadata:
|
||||
m = Metadata(None)
|
||||
object.__setattr__(m, '_data', copy.deepcopy(object.__getattribute__(self, '_data')))
|
||||
# Also copy these two top-level attributes as they can appear in templates.
|
||||
object.__setattr__(m, 'id', copy.copy(self.get('id')))
|
||||
object.__setattr__(m, 'has_cover', copy.copy(self.get('has_cover')))
|
||||
with suppress(AttributeError):
|
||||
object.__setattr__(m, 'id', copy.copy(self.__getattribute__('id')))
|
||||
with suppress(AttributeError):
|
||||
object.__setattr__(m, 'has_cover', copy.copy(self.__getattribute__('has_cover')))
|
||||
return m
|
||||
|
||||
def get(self, field, default=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user