[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form -
configure.zcml:1.21 widget.py:1.48
Gary Poster
gary at zope.com
Tue Aug 12 15:18:38 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv6186
Modified Files:
configure.zcml widget.py
Log Message:
Add date widget
=== Zope3/src/zope/app/browser/form/configure.zcml 1.20 => 1.21 ===
--- Zope3/src/zope/app/browser/form/configure.zcml:1.20 Thu Aug 7 13:40:28 2003
+++ Zope3/src/zope/app/browser/form/configure.zcml Tue Aug 12 14:18:02 2003
@@ -72,6 +72,14 @@
<browser:page
permission="zope.Public"
allowed_interface="zope.app.interfaces.browser.form.IBrowserWidget"
+ for="zope.schema.interfaces.IDate"
+ name="edit"
+ class="zope.app.browser.form.widget.DateWidget"
+ />
+
+ <browser:page
+ permission="zope.Public"
+ allowed_interface="zope.app.interfaces.browser.form.IBrowserWidget"
for="zope.schema.interfaces.IBool"
name="edit"
class="zope.app.browser.form.widget.CheckBoxWidget"
=== Zope3/src/zope/app/browser/form/widget.py 1.47 => 1.48 ===
--- Zope3/src/zope/app/browser/form/widget.py:1.47 Thu Aug 7 20:14:28 2003
+++ Zope3/src/zope/app/browser/form/widget.py Tue Aug 12 14:18:02 2003
@@ -549,6 +549,17 @@
except (DateTimeError, ValueError, IndexError), v:
raise ConversionError("Invalid datetime data", v)
+class DateWidget(TextWidget):
+ "Date entry widget."
+ displayWidth = 20
+
+ def _convert(self, value):
+ if value:
+ try:
+ return parseDatetimetz(value).date()
+ except (DateTimeError, ValueError, IndexError), v:
+ raise ConversionError("Invalid datetime data", v)
+
class TextAreaWidget(PossiblyEmptyMeansMissing, BrowserWidget):
"""TextArea widget.
More information about the Zope3-Checkins
mailing list