[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/form/browser/form Make FormView.update return a status message on successful updates, just like

Marius Gedminas marius at pov.lt
Fri Jul 29 14:58:28 EDT 2005


Log message for revision 37558:
  Make FormView.update return a status message on successful updates, just like
  EditForm.update does.
  
  

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 18:19:31 UTC (rev 37557)
+++ Zope3/trunk/src/zope/app/form/browser/form.txt	2005-07-29 18:58:28 UTC (rev 37558)
@@ -79,7 +79,7 @@
 and as soon as the `update()` method is called
 
   >>> view.update()
-  ''
+  u'Updated on ${date_time}'
 
 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 18:19:31 UTC (rev 37557)
+++ Zope3/trunk/src/zope/app/form/browser/formview.py	2005-07-29 18:58:28 UTC (rev 37558)
@@ -16,6 +16,8 @@
 $Id: editview.py 29143 2005-02-14 22:43:16Z srichter $
 """
 __docformat__ = 'restructuredtext'
+
+from datetime import datetime
 import transaction
 
 from zope.app.form.interfaces import WidgetsError, IInputWidget
@@ -77,6 +79,11 @@
             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())}
                 setUpWidgets(
                     self, self.schema, IInputWidget, initial=self.data,
                     ignoreStickyValues=True, names=self.fieldNames)



More information about the Zope3-Checkins mailing list