[Zope3-checkins]
SVN: Zope3/trunk/src/zope/app/form/browser/textwidgets.py
avoid code duplication
Fred L. Drake, Jr.
fdrake at gmail.com
Mon Mar 14 14:20:17 EST 2005
Log message for revision 29466:
avoid code duplication
Changed:
U Zope3/trunk/src/zope/app/form/browser/textwidgets.py
-=-
Modified: Zope3/trunk/src/zope/app/form/browser/textwidgets.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/textwidgets.py 2005-03-14 18:54:17 UTC (rev 29465)
+++ Zope3/trunk/src/zope/app/form/browser/textwidgets.py 2005-03-14 19:20:17 UTC (rev 29466)
@@ -475,20 +475,15 @@
raise ConversionError(_("Invalid datetime data"), v)
-class DateWidget(TextWidget):
+class DateWidget(DatetimeWidget):
"""Date entry widget.
"""
- displayWidth = 20
-
def _toFieldValue(self, input):
- if input == self._missing:
- return self.context.missing_value
- else:
- try:
- return parseDatetimetz(input).date()
- except (DateTimeError, ValueError, IndexError), v:
- raise ConversionError(_("Invalid datetime data"), v)
+ v = super(DateWidget, self)._toFieldValue(input)
+ if v != self.context.missing_value:
+ v = v.date()
+ return v
class DateDisplayWidget(DisplayWidget):
More information about the Zope3-Checkins
mailing list