diff options
Diffstat (limited to 'src/pyexiv2.py')
-rw-r--r-- | src/pyexiv2.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index 1aec66f..c66c73c 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -1098,13 +1098,20 @@ class ImageMetadata(object): tag.metadata = self def _set_iptc_tag_values(self, key, values): - # Overwrite the tag value for an already existing tag. + # Overwrite the tag values 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). - # TODO - raise NotImplementedError() + # FIXME: this is sub-optimal as it sets all the values regardless of how + # many of them really changed. Need to implement the same method with an + # index/range parameter (here and in the C++ wrapper). + if key not in self.iptc_keys: + raise KeyError('Cannot set the value of an inexistent tag') + if type(values) is not list or not \ + reduce(lambda x, y: x and type(y) is str, values, True): + raise TypeError('Expecting a list of strings') + self._image.setIptcTagValues(key, values) def _set_xmp_tag(self, tag): # TODO |