[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - addwizard.py:1.2 editwizard.py:1.4

Stuart Bishop zen@shangri-la.dropbear.id.au
Sun, 13 Jul 2003 00:47:40 -0400


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

Modified Files:
	addwizard.py editwizard.py 
Log Message:
Minor tweaks and cleanup of wizard

=== Zope3/src/zope/app/browser/form/addwizard.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/form/addwizard.py:1.1	Sun Jul 13 00:05:58 2003
+++ Zope3/src/zope/app/browser/form/addwizard.py	Sun Jul 13 00:47:35 2003
@@ -60,7 +60,6 @@
         """
         return self._factory(*args, **kw)
 
-    #def createAndAdd(self, data):
     def apply_update(self, data):
         """Add the desired object using the data in the data argument.
 
@@ -71,7 +70,7 @@
         Returns False, as per editview.apply_update
         """
 
-        # Cut & Paste from add.py
+        # This code originally from add.py's createAndAdd method
         
         args = []
         for name in self._arguments:
@@ -115,17 +114,12 @@
         if errors:
             raise WidgetsError(*errors)
 
-        #return content
         self.request.response.redirect(self.context.nextURL())
         return False
 
     def add(self, content):
         # Cut & Paste from add.py
         return self.context.add(content)
-
-    def nextURL(self):
-        # Cut & Paste from add.py
-        return self.context.nextURL()
 
 
 def AddWizardViewFactory(


=== Zope3/src/zope/app/browser/form/editwizard.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/form/editwizard.py:1.3	Sun Jul 13 00:05:58 2003
+++ Zope3/src/zope/app/browser/form/editwizard.py	Sun Jul 13 00:47:35 2003
@@ -126,11 +126,9 @@
                 self, self.schema, strict=True, set_missing=True, 
                 names=names, exclude_readonly=True
                 )
-            valid = 1
             self.errors = []
         except WidgetsError, errors:
             self.errors = errors
-            valid = 0
 
         else:
             self.storage.update(data)
@@ -147,12 +145,6 @@
                 else:
                     self.feedback = _(u'Changes saved')
 
-        # Set last_pane flag - last_pane always gets a submit button
-        if self._current_pane_idx == len(self.panes) - 1:
-            self.last_pane = True
-        else:
-            self.last_pane = False
-
         # Set the current label
         self.label = self.currentPane().label
 
@@ -204,9 +196,6 @@
                     out(widget.hidden())
             return ''.join(olist)
 
-    def done(self):
-        ''' Called after changes have been saved '''
-
 
 class Pane:
     # TODO: Add more funky stuff to each pane, such as a validator
@@ -229,9 +218,9 @@
         self.layer = layer
         self.menu = menu
 
-        if use_session == 'yes':
+        if use_session.lower() == 'yes':
             self.use_session = True
-        elif use_session == 'no':
+        elif use_session.lower() == 'no':
             self.use_session = False
         else:
             raise ValueError('Invalid value %r for use_session'%(use_session,))
@@ -239,7 +228,8 @@
         if menu:
             actions = menuItemDirective(
                 _context, menu, for_ or schema, '@@' + name, title,
-                permission=permission)
+                permission=permission
+                )
         else:
             actions = []
 
@@ -258,10 +248,8 @@
         self.actions = actions
 
     def pane(self, _context, fields, label=''):
-        # TODO: Maybe accept a default of None for fields, meaning 'all 
-        # remaining fields
         fields = [str(f) for f in fields.split(' ')]
-        # TODO: unittest validation
+
         for f in fields:
             if f not in self.all_fields:
                 raise ValueError(
@@ -288,6 +276,7 @@
             )
         return self.actions
 
+
 def EditWizardViewFactory(name, schema, permission, layer,
                     panes, fields, template, default_template, bases, for_, 
                     menu=u'', usage=u'', use_session=True):
@@ -303,9 +292,10 @@
     class_.usage = usage or (
         menu and globalBrowserMenuService.getMenuUsage(menu))
 
-    defineChecker(class_,
-                  NamesChecker(("__call__", "__getitem__", "browserDefault"),
-                               permission))
+    defineChecker(
+        class_,
+        NamesChecker(("__call__", "__getitem__", "browserDefault"), permission)
+        )
 
     provideView(for_, name, IBrowserPresentation, class_, layer)