[Checkins] SVN: zope.app.form/trunk/ Use standard properties instead of `zope.cachedescriptors`
Hanno Schlichting
hannosch at hannosch.eu
Sun May 24 15:37:21 EDT 2009
Log message for revision 100342:
Use standard properties instead of `zope.cachedescriptors`
Changed:
U zope.app.form/trunk/CHANGES.txt
U zope.app.form/trunk/setup.py
U zope.app.form/trunk/src/zope/app/form/__init__.py
U zope.app.form/trunk/src/zope/app/form/tests/test_widget.py
-=-
Modified: zope.app.form/trunk/CHANGES.txt
===================================================================
--- zope.app.form/trunk/CHANGES.txt 2009-05-24 19:21:42 UTC (rev 100341)
+++ zope.app.form/trunk/CHANGES.txt 2009-05-24 19:37:20 UTC (rev 100342)
@@ -5,6 +5,8 @@
3.8.0 (unreleased)
==================
+- Use standard properties instead of `zope.cachedescriptors`.
+
- Require `zope.browser` 1.1 instead of `zope.app.container` for IAdding.
3.7.3 (2009-05-11)
Modified: zope.app.form/trunk/setup.py
===================================================================
--- zope.app.form/trunk/setup.py 2009-05-24 19:21:42 UTC (rev 100341)
+++ zope.app.form/trunk/setup.py 2009-05-24 19:37:20 UTC (rev 100342)
@@ -68,7 +68,6 @@
"ZODB3",
"zope.browser >= 1.1",
"zope.app.publisher",
- "zope.cachedescriptors",
"zope.component",
"zope.configuration",
"zope.exceptions",
Modified: zope.app.form/trunk/src/zope/app/form/__init__.py
===================================================================
--- zope.app.form/trunk/src/zope/app/form/__init__.py 2009-05-24 19:21:42 UTC (rev 100341)
+++ zope.app.form/trunk/src/zope/app/form/__init__.py 2009-05-24 19:37:20 UTC (rev 100342)
@@ -18,7 +18,6 @@
__docformat__ = 'restructuredtext'
from zope.app.form.interfaces import IWidget, InputErrors, IWidgetFactory
-from zope.cachedescriptors.property import readproperty
from zope.interface import implements
from zope.i18n import translate
from zope.schema.interfaces import IChoice, ICollection
@@ -39,22 +38,30 @@
self.request = request
self.name = self._prefix + context.__name__
- @readproperty
- def label(self):
+ def get_label(self):
"""The widget label.
This read-write attribute defaults to the title of the context.
"""
return self.context.title
- @readproperty
- def hint(self):
+ def set_label(self, value):
+ self.context.title = value
+
+ label = property(get_label, set_label)
+
+ def get_hint(self):
"""A hint regarding the use of the widget.
This read-write attribute defaults to the description of the context.
"""
return self.context.description
+ def set_hint(self, value):
+ self.context.description = value
+
+ hint = property(get_hint, set_hint)
+
def _translate(self, text):
return translate(text, context=self.request, default=text)
Modified: zope.app.form/trunk/src/zope/app/form/tests/test_widget.py
===================================================================
--- zope.app.form/trunk/src/zope/app/form/tests/test_widget.py 2009-05-24 19:21:42 UTC (rev 100341)
+++ zope.app.form/trunk/src/zope/app/form/tests/test_widget.py 2009-05-24 19:37:20 UTC (rev 100342)
@@ -118,11 +118,7 @@
>>> from zope.schema import Field
>>> field = Field()
- >>> from zope.interface import Interface
- >>> class ITestRequest(Interface):
- ... pass
- >>> from zope.app.component.tests.views import Request
- >>> widget = TestInputWidget(field, Request(ITestRequest))
+ >>> widget = TestInputWidget(field, TestRequest())
The default implementation of hasValidInput relies on
getInputValue to perform the validation of the current widget input.
More information about the Checkins
mailing list