[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - add.py:1.9.8.1

Jim Fulton jim@zope.com
Tue, 18 Mar 2003 07:36:19 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/app/browser/form

Modified Files:
      Tag: local-utility-branch
	add.py 
Log Message:
Checking in current code to the branch.

It may be in a state of non-working-ness. We'll fix that later.

We're currently trying to clean up the logic for adding configs.


=== Zope3/src/zope/app/browser/form/add.py 1.9 => 1.9.8.1 ===
--- Zope3/src/zope/app/browser/form/add.py:1.9	Fri Feb 21 09:53:35 2003
+++ Zope3/src/zope/app/browser/form/add.py	Tue Mar 18 07:35:48 2003
@@ -44,13 +44,11 @@
         setUpWidgets(self, self.schema, names=self.fieldNames)
 
     def apply_update(self, data):
-        """Apply data updates
+        """Add the desirted object using the data in the data arument
 
-        Return true if data were unchanged and false otherwise.
-        This sounds backwards, but it allows lazy implementations to
-        avoid tracking changes.
+        The data argument is a dictionary with the data entered in the form.
         """
-
+        
         args = []
         for name in self._arguments:
             args.append(data[name])
@@ -76,7 +74,7 @@
 
         publish(content, ObjectCreatedEvent(content))
 
-        content = self.context.add(content)
+        content = self.add(content)
 
         for name in self._set_after_add:
             if name in data:
@@ -102,7 +100,14 @@
                 self.errors = errors
                 return u"An error occured."
 
-            self.request.response.redirect(self.context.nextURL())
+            self.request.response.redirect(self.nextURL())
+
+    # Overide these to work with something other than IAdding
+    def nextURL(self):
+        return self.context.nextURL()
+
+    def add(self, content):
+        return self.context.add(content)
 
 
 def AddViewFactory(name, schema, label, permission, layer,