[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - add.py:1.9.8.3 meta.zcml:1.5.8.2
Guido van Rossum
guido@python.org
Tue, 18 Mar 2003 16:10:32 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv22675/zope/app/browser/form
Modified Files:
Tag: local-utility-branch
add.py meta.zcml
Log Message:
Another checkpoint.
=== Zope3/src/zope/app/browser/form/add.py 1.9.8.2 => 1.9.8.3 ===
--- Zope3/src/zope/app/browser/form/add.py:1.9.8.2 Tue Mar 18 11:55:43 2003
+++ Zope3/src/zope/app/browser/form/add.py Tue Mar 18 16:10:01 2003
@@ -33,7 +33,7 @@
from zope.app.browser.form.editview import EditView, _normalize
class AddView(EditView):
- """Simple edit-view base class
+ """Simple edit-view base class.
Subclasses should provide a schema attribute defining the schema
to be edited.
@@ -42,8 +42,33 @@
def _setUpWidgets(self):
setUpWidgets(self, self.schema, names=self.fieldNames)
+ def update(self):
+
+ if self.update_status is not None:
+ # We've been called before. Just return the previous result.
+ return self.update_status
+
+ self.beforeUpdateHook()
+
+ if Update in self.request:
+ try:
+ data = getWidgetsData(self, self.schema,
+ strict=False,
+ names=self.fieldNames,
+ set_missing=False)
+ content = self.createAndAdd(data)
+ except WidgetsError, errors:
+ self.errors = errors
+ self.update_status = u"An error occured."
+ return self.update_status
+
+ self.request.response.redirect(self.nextURL())
+
+ def beforeUpdateHook(self):
+ pass
+
def createAndAdd(self, data):
- """Add the desirted object using the data in the data arument
+ """Add the desired object using the data in the data argument.
The data argument is a dictionary with the data entered in the form.
"""
@@ -87,36 +112,11 @@
return content
- def update(self):
-
- if self.update_status is not None:
- # We've been called before. Just return the previous result.
- return self.update_status
-
- self.beforeUpdateHook()
-
- if Update in self.request:
- try:
- data = getWidgetsData(self, self.schema,
- strict=False,
- names=self.fieldNames,
- set_missing=False)
- content = self.createAndAdd(data)
- except WidgetsError, errors:
- self.errors = errors
- self.update_status = u"An error occured."
- return self.update_status
-
- self.request.response.redirect(self.nextURL())
-
- def beforeUpdateHook(self):
- pass
+ def add(self, content):
+ return self.context.add(content)
def nextURL(self):
return self.context.nextURL()
-
- def add(self, content):
- return self.context.add(content)
def AddViewFactory(name, schema, label, permission, layer,
=== Zope3/src/zope/app/browser/form/meta.zcml 1.5.8.1 => 1.5.8.2 ===
--- Zope3/src/zope/app/browser/form/meta.zcml:1.5.8.1 Tue Mar 18 11:55:43 2003
+++ Zope3/src/zope/app/browser/form/meta.zcml Tue Mar 18 16:10:01 2003
@@ -152,7 +152,8 @@
IAdding is used if this attribute isn't specified. If this
attribute is specified, then either the named interface must
extend IAdding or a class attribute must be used to supply a
- class implements certain methods described in
+ class implements certain methods described in
+ zope.app.interfaces.browser.form.IAddFormCustomization.
The schema is used if the for attribute is not specified.
@@ -190,6 +191,8 @@
<description>
A class to provide custom widget definitions or methods to be
used by a custom template.
+
+ This class can override methods defined in IAddFormCustomization.
This class is used as a mix-in class. As a result, it needn't
subclass any special classes, such as BrowserView.