[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - add.py:1.1.2.3 editview.py:1.1.2.3 submit.py:1.1.2.2 widget.py:1.1.2.3

Tim Peters tim.one@comcast.net
Tue, 24 Dec 2002 21:21:45 -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: NameGeddon-branch
	add.py editview.py submit.py widget.py 
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py.  The
files are fixed-points of that script now.  Fixed a few cases where
code relied on significant trailing whitespace (ouch).


=== Zope3/src/zope/app/browser/form/add.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/browser/form/add.py:1.1.2.2	Tue Dec 24 07:50:50 2002
+++ Zope3/src/zope/app/browser/form/add.py	Tue Dec 24 21:20:14 2002
@@ -2,14 +2,14 @@
 #
 # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
 """
 $Id$
@@ -82,7 +82,7 @@
         except:
             errors.append(sys.exc_info()[1])
             raise WidgetsError(*errors)
-            
+
 
         for name in self._set_after_add:
             if name in data:
@@ -132,7 +132,7 @@
     class_._keyword_arguments = keyword_arguments
     class_._set_before_add = set_before_add
     class_._set_after_add = set_after_add
-    
+
     class_.generated_form = ViewPageTemplateFile(default_template)
 
     defineChecker(class_,
@@ -143,8 +143,8 @@
                   )
 
     provideView(for_, name, IBrowserPresentation, class_, layer)
-    
-def add(_context, name, schema, label, content_factory, 
+
+def add(_context, name, schema, label, content_factory,
         permission = 'zope.Public', layer = "default",
         class_ = None, for_ = None,
         template = None, omit=None, fields=None,
@@ -198,7 +198,7 @@
         set_after_add += leftover
 
     else:
-        
+
         set_after_add = leftover
 
     return [
@@ -211,5 +211,3 @@
                 keyword_arguments, set_before_add, set_after_add),
         )
         ]
-
-


=== Zope3/src/zope/app/browser/form/editview.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/browser/form/editview.py:1.1.2.2	Tue Dec 24 07:50:50 2002
+++ Zope3/src/zope/app/browser/form/editview.py	Tue Dec 24 21:20:14 2002
@@ -2,14 +2,14 @@
 #
 # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
 """
 $Id$
@@ -43,7 +43,7 @@
 
     # Fall-back field names computes from schema
     fieldNames = property(lambda self: fieldNames(self.schema))
-        
+
     def __init__(self, context, request):
         super(EditView, self).__init__(context, request)
         setUpEditWidgets(self, self.schema, names=self.fieldNames)
@@ -64,7 +64,7 @@
         This sounds backwards, but it allows lazy implementations to
         avoid tracking changes.
         """
-            
+
         content = self.context
 
         errors = []
@@ -140,7 +140,7 @@
     class_.fulledit_path = fulledit_path
     if fulledit_path and (fulledit_label is None):
         fulledit_label = "Full edit"
-        
+
     class_.fulledit_label = fulledit_label
 
     class_.generated_form = ViewPageTemplateFile(default_template)
@@ -153,7 +153,7 @@
                   )
 
     provideView(for_, name, IBrowserPresentation, class_, layer)
-                  
+
 
 def _normalize(_context, schema_, for_, class_, template, default_template,
                fields, omit, view=EditView):
@@ -168,7 +168,7 @@
         bases = (view, )
     else:
         bases = (_context.resolve(class_), view)
-        
+
 
     if template is not None:
         template = _context.path(template)
@@ -178,7 +178,7 @@
     template = str(template)
 
     names = fieldNames(schema)
-    
+
     if fields:
         fields = fields.split()
         for name in fields:
@@ -227,7 +227,7 @@
     (schema, for_, bases, template, fields,
      ) = _normalize(
         _context, schema, for_, class_, template, 'subedit.pt', fields, omit)
-    
+
     return [
         Action(
         discriminator = ('http://namespaces.zope.org/form/subedit',
@@ -238,5 +238,3 @@
                 for_, fields, fulledit, fulledit_label),
         )
         ]
-
-


=== Zope3/src/zope/app/browser/form/submit.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/browser/form/submit.py:1.1.2.1	Mon Dec 23 14:31:07 2002
+++ Zope3/src/zope/app/browser/form/submit.py	Tue Dec 24 21:20:14 2002
@@ -2,14 +2,14 @@
 #
 # Copyright (c) 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
 """Standard submit button names
 


=== Zope3/src/zope/app/browser/form/widget.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/browser/form/widget.py:1.1.2.2	Tue Dec 24 07:50:50 2002
+++ Zope3/src/zope/app/browser/form/widget.py	Tue Dec 24 21:20:14 2002
@@ -2,14 +2,14 @@
 #
 # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
 """
 $Id$
@@ -34,9 +34,9 @@
 
     __implements__ = IBrowserWidget
 
-    propertyNames = (Widget.propertyNames + 
+    propertyNames = (Widget.propertyNames +
                      ['tag', 'type', 'cssClass', 'extra'])
-    
+
     tag = 'input'
     type = 'text'
     cssClass = ''
@@ -99,7 +99,7 @@
             data = self._data
 
         return self._unconvert(data)
-    
+
     def __call__(self):
         return renderElement(self.getValue('tag'),
                              type = self.getValue('type'),
@@ -115,7 +115,7 @@
                              value = self._showData(),
                              cssClass = self.getValue('cssClass'),
                              extra = self.getValue('extra'))
-        
+
 
 
     def render(self, value):
@@ -151,7 +151,7 @@
 
     def __call__(self):
         data = self._showData()
-        
+
         if data:
             return renderElement(self.getValue('tag'),
                                  type = self.getValue('type'),
@@ -201,7 +201,7 @@
 
     def __init__(self, *args):
         super(TextWidget, self).__init__(*args)
-        
+
         if self.context.allowed_values is not None:
             values = list(self.context.allowed_values)
             values.sort()
@@ -219,7 +219,7 @@
         return False
 
     def _select(self):
-        selected = self._showData()        
+        selected = self._showData()
         result = ['<select name="%s">'
                   % (self.name)]
 
@@ -227,7 +227,7 @@
 
         if not self.context.required or selected is None:
             result.append('<option value="%s"></option>' % self._missing)
-        
+
         for value in values:
             if value == selected:
                 result.append("<option selected>%s</option>" % value)
@@ -240,7 +240,7 @@
     def __call__(self):
         if self.__values is not None:
             return self._select()
-        
+
         displayMaxWidth = self.getValue('displayMaxWidth') or 0
         if displayMaxWidth > 0:
             return renderElement(self.getValue('tag'),
@@ -291,7 +291,7 @@
     """Textarea widget."""
     propertyNames = BrowserWidget.propertyNames +\
                      ['width', 'height', 'extra']
-    
+
     default = ""
     width = 60
     height = 15
@@ -302,7 +302,7 @@
         if self.context.min_length and not value:
             return None
         return value
-    
+
     def __call__(self):
         return renderElement("textarea",
                              name = self.name,
@@ -352,7 +352,7 @@
             return 0
         if getattr(file, 'filename', ''):
             return 1
-        
+
         file.seek(0)
         if file.read(1):
             return 1
@@ -381,7 +381,7 @@
     """A widget with a number of items that has only a single
     selectable item."""
     default = ""
-    firstItem = 0    
+    firstItem = 0
 
     def renderItems(self, value):
         name = self.name
@@ -395,9 +395,9 @@
                 text, value = items[0]
             except ValueError:
                 value = items[0]
-                
+
         cssClass = self.getValue('cssClass')
-        
+
         # FIXME: what if we run into multiple items with same value?
         rendered_items = []
         for item in items:
@@ -417,7 +417,7 @@
                                                 item_value,
                                                 name,
                                                 cssClass)
-                
+
             rendered_items.append(rendered_item)
 
         return rendered_items
@@ -453,7 +453,7 @@
     propertyNames = SingleItemsWidget.propertyNames +\
                      ['firstItem', 'orientation']
     orientation = "vertical"
-                                   
+
     def __call__(self):
         rendered_items = self.renderItems(self._showData())
         orientation = self.getValue('orientation')
@@ -468,7 +468,7 @@
                               cssClass = cssClass,
                               name = name,
                               value = value) + text
-    
+
     def renderSelectedItem(self, text, value, name, cssClass):
         return renderElement('input',
                               type="radio",
@@ -488,7 +488,7 @@
         if isinstance(value, ListTypes):
             return value
         return [value]
-        
+
     def renderItems(self, value):
         # need to deal with single item selects
         value = removeAllProxies(value)
@@ -537,21 +537,21 @@
                               size = self.getValue('size'),
                               contents = "\n".join(rendered_items),
                               extra = self.getValue('extra'))
-    
+
     def renderItem(self, text, value, name, cssClass):
         return renderElement('option', contents=text, value=value)
 
     def renderSelectedItem(self, text, value, name, cssClass):
         return renderElement('option', contents=text, value=value,
                               selected=None)
-    
+
 
 class MultiCheckBoxWidget(MultiItemsWidget):
     """Multiple checkbox widget."""
     propertyNames = MultiItemsWidget.propertyNames +\
                      ['orientation']
     orientation = "vertical"
-                                   
+
     def __call__(self):
         rendered_items = self.renderItems(self._showData())
         orientation = self.getValue('orientation')
@@ -559,14 +559,14 @@
             return "&nbsp;&nbsp;".join(rendered_items)
         else:
             return "<br />".join(rendered_items)
-    
+
     def renderItem(self, text, value, name, cssClass):
         return renderElement('input',
                               type = "checkbox",
                               cssClass = cssClass,
                               name = name,
                               value = value) + text
-    
+
     def renderSelectedItem(self, text, value, name, cssClass):
         return renderElement('input',
                               type = "checkbox",
@@ -600,7 +600,7 @@
         if value == None:
             value = key
         attr_list.append('%s="%s"' % (key, str(value)))
-            
+
     attr_str = " ".join(attr_list)
     return "<%s %s %s" % (tag, attr_str, extra)