diff options
author | Jason Madden <jamadden@gmail.com> | 2017-12-18 11:27:23 -0600 |
---|---|---|
committer | Jason Madden <jamadden@gmail.com> | 2017-12-18 11:27:23 -0600 |
commit | 35a787d26bef89ca40318d66aef443c26ac0ddee (patch) | |
tree | 1d9dfc5032408129d9748e1636ffff9700ee3a9a | |
parent | 5a84f3710ab6c6b7e9d3e0f04cc5e03377dfbbea (diff) | |
download | zope-i18n-35a787d26bef89ca40318d66aef443c26ac0ddee.tar.gz |
Deprecate 'value' with a warning.
-rw-r--r-- | setup.py | 1 | ||||
-rw-r--r-- | src/zope/i18n/locales/inheritance.py | 13 |
2 files changed, 12 insertions, 2 deletions
@@ -98,6 +98,7 @@ setup( 'setuptools', 'python-gettext', 'pytz', + 'zope.deprecation', 'zope.schema', 'zope.i18nmessageid', 'zope.component', diff --git a/src/zope/i18n/locales/inheritance.py b/src/zope/i18n/locales/inheritance.py index 8489d7d..eee6bf6 100644 --- a/src/zope/i18n/locales/inheritance.py +++ b/src/zope/i18n/locales/inheritance.py @@ -20,6 +20,8 @@ locale inheritance is not inheritance in the programming sense. """ __docformat__ = 'restructuredtext' +from zope.deprecation import deprecate + from zope.interface import implementer from zope.i18n.interfaces.locales import \ ILocaleInheritance, IAttributeInheritance, IDictionaryInheritance @@ -183,6 +185,14 @@ class InheritingDictionary(Inheritance, dict): >>> sorted(locale.data.values()) ['eins', 'three', 'two'] + + Historically, ``value`` was a synonym of this method; it is still + available, but is deprecated:: + + >>> from zope.deprecation import Suppressor + >>> with Suppressor(): + ... sorted(locale.data.value()) + ['eins', 'three', 'two'] """ @@ -228,5 +238,4 @@ class InheritingDictionary(Inheritance, dict): def values(self): return list(self._make_reified_inherited_dict().values()) - # Preserve the old name for compatibility - value = values + value = deprecate("`value` is an old synonym for `values`")(values) |