diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-04-21 20:14:39 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-04-21 20:14:39 +0200 |
commit | a23bf770e4621a5dc65fccf723edd01ea7deec7c (patch) | |
tree | 68d406f00fd762adf79281178090d1f0c0f78933 /src/pyexiv2.py | |
parent | 279b974080eafb42af1f8da3920e2c4d04e63a0f (diff) | |
download | pyexiv2-a23bf770e4621a5dc65fccf723edd01ea7deec7c.tar.gz |
Private value setter for XMP tags.
Diffstat (limited to 'src/pyexiv2.py')
-rw-r--r-- | src/pyexiv2.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index 65bcce7..e550a01 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -1005,6 +1005,14 @@ class XmpTag(MetadataTag): raise NotImplementedError('XMP conversion for type [%s]' % xtype) + def to_string(self): + """ + Return a string representation of the XMP tag suitable to pass to + libexiv2 to set the value of the tag. + DOCME + """ + return XmpTag._convert_to_string(self.value, self.xtype) + def __str__(self): """ Return a string representation of the XMP tag. @@ -1163,7 +1171,11 @@ class ImageMetadata(object): # the internal cache (which would leave the object in an inconsistent # state). # TODO - raise NotImplementedError() + if key not in self.xmp_keys: + raise KeyError('Cannot set the value of an inexistent tag') + if type(value) is not str: + raise TypeError('Expecting a string') + self._image.setXmpTagValue(key, value) def __setitem__(self, key, tag): """ |