[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/form/browser/form
FormView may be used for all kinds of forms, so it is a bad idea to
Marius Gedminas
marius at pov.lt
Fri Jul 29 16:03:19 EDT 2005
Log message for revision 37560:
FormView may be used for all kinds of forms, so it is a bad idea to
unconditionally set the status message to 'Updated on ${date_time}'.
Instead, let the mixin class return a status message from the setData
method.
Changed:
U Zope3/trunk/src/zope/app/form/browser/form.txt
U Zope3/trunk/src/zope/app/form/browser/formview.py
-=-
Modified: Zope3/trunk/src/zope/app/form/browser/form.txt
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/form.txt 2005-07-29 20:02:09 UTC (rev 37559)
+++ Zope3/trunk/src/zope/app/form/browser/form.txt 2005-07-29 20:03:19 UTC (rev 37560)
@@ -43,6 +43,7 @@
... global name
... name[0] = data['first']
... name[1] = data['last']
+ ... return u"Saved changes."
We now imitate the form-directive's behavior and create the view class:
@@ -79,7 +80,7 @@
and as soon as the `update()` method is called
>>> view.update()
- u'Updated on ${date_time}'
+ u'Saved changes.'
the global name variable is changed:
Modified: Zope3/trunk/src/zope/app/form/browser/formview.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/formview.py 2005-07-29 20:02:09 UTC (rev 37559)
+++ Zope3/trunk/src/zope/app/form/browser/formview.py 2005-07-29 20:03:19 UTC (rev 37560)
@@ -17,7 +17,6 @@
"""
__docformat__ = 'restructuredtext'
-from datetime import datetime
import transaction
from zope.app.form.interfaces import WidgetsError, IInputWidget
@@ -51,6 +50,8 @@
"""Set the data gotten from a form.
The data will be a dictionary of fieldnames to values.
+
+ May return a status message.
"""
NotImplemented, 'Must be implemented by a specific form class'
@@ -78,12 +79,7 @@
transaction.abort()
else:
if changed:
- self.setData(self.data)
- formatter = self.request.locale.dates.getFormatter(
- 'dateTime', 'medium')
- status = _("Updated on ${date_time}")
- status.mapping = {'date_time': formatter.format(
- datetime.utcnow())}
+ status = self.setData(self.data)
setUpWidgets(
self, self.schema, IInputWidget, initial=self.data,
ignoreStickyValues=True, names=self.fieldNames)
More information about the Zope3-Checkins
mailing list