aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-01-27 20:28:45 +0100
committerOlivier Tilloy <olivier@tilloy.net>2009-01-27 20:28:45 +0100
commite729a212a72a9dbbcaa4a896194290c1bf258ae0 (patch)
tree7dddb045e3fde7e3b149426f8711dfc195b8f591 /src
parent2df704760f64ba36f0190ebc1f8344801d35d3c6 (diff)
downloadpyexiv2-e729a212a72a9dbbcaa4a896194290c1bf258ae0.tar.gz
XMP Boolean to string conversion + unit tests.
Diffstat (limited to 'src')
-rw-r--r--src/pyexiv2.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py
index 5341c86..2c00e2d 100644
--- a/src/pyexiv2.py
+++ b/src/pyexiv2.py
@@ -615,6 +615,21 @@ class XmpTag(MetadataTag):
return value
+ @staticmethod
+ def _convert_to_string(value, xtype):
+ """
+ Convert a value to its corresponding string representation.
+ Fallback to str(value) if no standard-compliant conversion can be done.
+ """
+ if xtype == 'Boolean':
+ if value == True:
+ return 'True'
+ elif value == False:
+ return 'False'
+
+ # Default fallback conversion
+ return str(value)
+
def __str__(self):
"""
Return a string representation of the XMP tag.