mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Here is an implementation of has_key() where both Metadata and ProxyMetadata do the same thing.
This commit is contained in:
parent
babc0b9e48
commit
356e312eb1
@ -387,7 +387,8 @@ class ProxyMetadata(Metadata):
|
||||
"Use the explicit methods such as all_field_keys()")
|
||||
|
||||
def has_key(self, key):
|
||||
return key in self.all_field_keys()
|
||||
from calibre.ebooks.metadata.book import STANDARD_METADATA_FIELDS
|
||||
return key in STANDARD_METADATA_FIELDS or key in ga(self, '_user_metadata')
|
||||
|
||||
def deepcopy(self, **kwargs):
|
||||
self._unimplemented_exception('deepcopy', add_txt=False)
|
||||
|
@ -201,7 +201,7 @@ class Metadata:
|
||||
return iter(object.__getattribute__(self, '_data'))
|
||||
|
||||
def has_key(self, key):
|
||||
return key in object.__getattribute__(self, '_data')
|
||||
return key in STANDARD_METADATA_FIELDS or key in object.__getattribute__(self, '_data')['user_metadata']
|
||||
|
||||
def _evaluate_all_composites(self):
|
||||
custom_fields = object.__getattribute__(self, '_data')['user_metadata']
|
||||
|
Loading…
x
Reference in New Issue
Block a user