diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-10-08 09:46:09 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@fluendo.com> | 2009-10-08 09:46:09 +0200 |
commit | a8416d896fba0579093cb4c11f90d8665157cb04 (patch) | |
tree | 4bcd1c197caf147d43219d130812032872dc6933 | |
parent | 31d240d6cef0fa252f9e963cbcdf462e6092d37e (diff) | |
download | pyexiv2-a8416d896fba0579093cb4c11f90d8665157cb04.tar.gz |
Fixed representations of IPTC tags (__repr__, __str__ and to_string).
-rw-r--r-- | src/pyexiv2.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index 5f17e92..c2257c4 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -933,8 +933,8 @@ class IptcTag(MetadataTag): def to_string(self): """ - Return a list of string representations of the IPTC tag values suitable - to pass to libexiv2 to set the value of the tag. + Return a list of string representations of the values of the IPTC tag + suitable to pass to libexiv2 to set it. @rtype: C{list} of C{str} """ @@ -942,17 +942,19 @@ class IptcTag(MetadataTag): def __str__(self): """ + Return a string representation of the list of values of the IPTC tag. + + @rtype: C{str} + """ + return ', '.join(self.to_string()) + + def __repr__(self): + """ Return a string representation of the IPTC tag for debugging purposes. @rtype: C{str} """ - r = 'Key = ' + self.key + os.linesep + \ - 'Name = ' + self.name + os.linesep + \ - 'Label = ' + self.label + os.linesep + \ - 'Description = ' + self.description + os.linesep + \ - 'Type = ' + self.type + os.linesep + \ - 'Values = ' + str(self.values) - return r + return '<%s [%s] = %s>' % (self.key, self.type, str(self)) class XmpValueError(ValueError): |