[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - edit.pt:1.7 editview.py:1.15
Jim Fulton
jim@zope.com
Fri, 21 Mar 2003 15:58:14 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv18272/src/zope/app/browser/form
Modified Files:
edit.pt editview.py
Log Message:
Changed so that multiple calls to update are ignored.
This is useful because it let us add an extra call to the top of
full-page the template so that updates are applied before standard
look and feel is rendered. This means that standard elements like tabs
and modification times can reflect changes.
=== Zope3/src/zope/app/browser/form/edit.pt 1.6 => 1.7 ===
--- Zope3/src/zope/app/browser/form/edit.pt:1.6 Fri Mar 7 11:39:41 2003
+++ Zope3/src/zope/app/browser/form/edit.pt Fri Mar 21 15:57:44 2003
@@ -1,4 +1,5 @@
-<html metal:use-macro="views/standard_macros/page">
+<tal:tag condition="view/update"
+/><html metal:use-macro="views/standard_macros/page">
<body>
<div metal:fill-slot="body">
@@ -51,8 +52,12 @@
</div>
- <input type="submit" value="Refresh" />
- <input type="submit" name="UPDATE_SUBMIT" value="Save Changes" />
+ <div class="row">
+ <div class="controls">
+ <input type="submit" value="Refresh" />
+ <input type="submit" name="UPDATE_SUBMIT" value="Submit" />
+ </div>
+ </div>
</form>
=== Zope3/src/zope/app/browser/form/editview.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/browser/form/editview.py:1.14 Fri Mar 7 16:28:51 2003
+++ Zope3/src/zope/app/browser/form/editview.py Fri Mar 21 15:57:44 2003
@@ -47,6 +47,7 @@
"""
errors = ()
+ update_status = None
label = ''
# Fall-back field names computes from schema
@@ -127,6 +128,13 @@
return unchanged
def update(self):
+ if self.update_status is not None:
+ # We've been called before. Just return the status we previously
+ # computed.
+ return self.update_status
+
+ status = ''
+
if Update in self.request:
unchanged = True
try:
@@ -138,14 +146,15 @@
unchanged = self.apply_update(data)
except WidgetsError, errors:
self.errors = errors
- return u"An error occured."
+ status = u"An error occured."
else:
setUpEditWidgets(self, self.schema, force=1,
names=self.fieldNames)
if not unchanged:
- return "Updated %s" % datetime.utcnow()
+ status = "Updated %s" % datetime.utcnow()
- return ''
+ self.update_status = status
+ return status
def EditViewFactory(name, schema, label, permission, layer,