diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-11-21 19:50:46 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-11-21 19:50:46 +0100 |
commit | 59a47104d5c6bf6ad94e7f54707c8ac4bf0a84ea (patch) | |
tree | 6b51bb9d876283d9cb57b50757f46301efd4a5b3 /src | |
parent | b446f84822b52451a6af48aa6ea1d58a07e0f1bf (diff) | |
download | pyexiv2-59a47104d5c6bf6ad94e7f54707c8ac4bf0a84ea.tar.gz |
Re-introduce the .raw_values and .values properties for compatibility,
but mark them as deprecated.
Diffstat (limited to 'src')
-rw-r--r-- | src/pyexiv2/iptc.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/pyexiv2/iptc.py b/src/pyexiv2/iptc.py index 8e20873..e30921c 100644 --- a/src/pyexiv2/iptc.py +++ b/src/pyexiv2/iptc.py @@ -35,6 +35,7 @@ from pyexiv2.utils import ListenerInterface, NotifyingList, FixedOffset import time import datetime import re +import warnings class IptcValueError(ValueError): @@ -173,6 +174,21 @@ class IptcTag(ListenerInterface): raw_value = property(fget=_get_raw_values, fset=_set_raw_values, doc='The raw values of the tag as a list of strings.') + def _get_raw_values_deprecated(self): + msg = "The 'raw_values' property is deprecated, " \ + "use the 'raw_value' property instead." + warnings.warn(msg, category=DeprecationWarning, stacklevel=2) + return self._get_raw_values() + + def _set_raw_values_deprecated(self, values): + msg = "The 'raw_values' property is deprecated, " \ + "use the 'raw_value' property instead." + warnings.warn(msg, category=DeprecationWarning, stacklevel=2) + return self._set_raw_values(values) + + raw_values = property(fget=_get_raw_values_deprecated, + fset=_set_raw_values_deprecated) + def _compute_values(self): # Lazy computation of the values from the raw values self._values = \ @@ -206,6 +222,20 @@ class IptcTag(ListenerInterface): value = property(fget=_get_values, fset=_set_values, doc='The values of the tag as a list of python objects.') + def _get_values_deprecated(self): + msg = "The 'values' property is deprecated, " \ + "use the 'value' property instead." + warnings.warn(msg, category=DeprecationWarning, stacklevel=2) + return self._get_values() + + def _set_values_deprecated(self, values): + msg = "The 'values' property is deprecated, " \ + "use the 'value' property instead." + warnings.warn(msg, category=DeprecationWarning, stacklevel=2) + return self._set_values(values) + + values = property(fget=_get_values_deprecated, fset=_set_values_deprecated) + def contents_changed(self): # Implementation of the ListenerInterface. # React on changes to the list of values of the tag. |