diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-03-26 09:59:08 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-03-26 09:59:08 +0100 |
commit | 938d8711997d22301718d3a181d638267abb0ef6 (patch) | |
tree | cfdb3d954d1622429d5a132d30f7f6f2220cb08b /src/pyexiv2.py | |
parent | c3d3594126d448f12060a584abc622fd2148560d (diff) | |
download | pyexiv2-938d8711997d22301718d3a181d638267abb0ef6.tar.gz |
Delete an EXIF tag.
Diffstat (limited to 'src/pyexiv2.py')
-rw-r--r-- | src/pyexiv2.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index 4046999..902301e 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -328,8 +328,7 @@ class ExifTag(MetadataTag): def _del_value(self): if self.metadata is not None: - # TODO - pass + self.metadata._delete_exif_tag(self.key) del self._value # DOCME @@ -1073,12 +1072,25 @@ class ImageMetadata(object): def _set_exif_tag_value(self, key, value): # Overwrite the tag value for an already existing tag. # The tag is already in cache. + # Warning: this is not meant to be called directly as it doesn't update + # the internal cache (which would leave the object in an inconsistent + # state). if key not in self.exif_keys: raise KeyError('Cannot set the value of an inexistent tag') if type(value) is not str: raise TypeError('Expecting a string') self._image.setExifTag(key, value) + def _delete_exif_tag(self, key): + if key not in self.exif_keys: + raise KeyError('Cannot delete an inexistent tag') + self._image.deleteExifTag(key) + try: + del self._tags['exif'][key] + except KeyError: + # The tag was not cached. + pass + class Image(libexiv2python.Image): |