diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-02-24 19:54:14 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-02-24 19:54:14 +0100 |
commit | 9564f01d928d2a654a4dd3933025e20266adddab (patch) | |
tree | 48de0b3a146ffa8c755749f4d1769133b76cb6ea /src/pyexiv2.py | |
parent | b7dfe1a41b0afca712384d67271fef0a4a860df4 (diff) | |
download | pyexiv2-9564f01d928d2a654a4dd3933025e20266adddab.tar.gz |
IPTC Short to string conversion.
Diffstat (limited to 'src/pyexiv2.py')
-rw-r--r-- | src/pyexiv2.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index afc2201..2c49db9 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -522,6 +522,31 @@ class IptcTag(MetadataTag): raise NotImplementedError('IPTC conversion for type [%s]' % xtype) + @staticmethod + def _convert_to_string(value, xtype): + """ + Convert a value to its corresponding string representation. + + @param value: the value to be converted + @type value: depends on xtype (DOCME) + @param xtype: the IPTC type of the value + @type xtype: C{str} + + @return: the value converted to its corresponding string representation + @rtype: C{str} + + @raise L{IptcValueError}: if the conversion fails + """ + if xtype == 'Short': + if type(value) is int: + return str(value) + else: + raise IptcValueError(value, xtype) + + # TODO: other types + + raise IptcValueError(value, xtype) + def __str__(self): """ Return a string representation of the IPTC tag. |