diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-08-18 09:33:16 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-08-18 09:33:16 +0200 |
commit | 1526b10d8564c0b43208cd41441eda75728c2ac6 (patch) | |
tree | 1c8d5295c1eada70dd89707b3bdbee96796f3bc7 | |
parent | 47f9b236116b2073c7d3c93ebb847f8ea0d05a71 (diff) | |
download | pyexiv2-1526b10d8564c0b43208cd41441eda75728c2ac6.tar.gz |
One-liner __str__ for MetadataTag and ExifTag.
-rw-r--r-- | src/pyexiv2.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index 6b6ed69..55ba8d1 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -439,13 +439,7 @@ class MetadataTag(object): @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 + \ - 'Raw value = ' + str(self.raw_value) - return r + return '<%s [%s] = %s>' % (self.key, self.type, str(self.raw_value)) class ExifValueError(ValueError): @@ -725,14 +719,12 @@ class ExifTag(MetadataTag, ListenerInterface): @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 + \ - 'Value = ' + str(self.value) + os.linesep + \ - 'Formatted value = ' + self.fvalue - return r + left = '%s [%s]' % (self.key, self.type) + if self.type == 'Undefined' and len(self._value) > 100: + right = '(Binary value suppressed)' + else: + right = self.fvalue + return '<%s = %s>' % (left, right) class IptcValueError(ValueError): |