[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/form/browser/ Deprecated passing None as an attribute value to

Jim Fulton jim at zope.com
Thu Dec 23 16:06:24 EST 2004


Log message for revision 28693:
  Deprecated passing None as an attribute value to
  zope.app.form.browser.widget.renderTag.
  

Changed:
  U   Zope3/trunk/src/zope/app/form/browser/boolwidgets.py
  U   Zope3/trunk/src/zope/app/form/browser/itemswidgets.py
  U   Zope3/trunk/src/zope/app/form/browser/widget.py

-=-
Modified: Zope3/trunk/src/zope/app/form/browser/boolwidgets.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/boolwidgets.py	2004-12-23 18:26:32 UTC (rev 28692)
+++ Zope3/trunk/src/zope/app/form/browser/boolwidgets.py	2004-12-23 21:06:23 UTC (rev 28693)
@@ -41,7 +41,7 @@
         """Render the widget to HTML."""
         value = self._getFormValue()
         if value == 'on':
-            kw = {'checked': None}
+            kw = {'checked': 'checked'}
         else:
             kw = {}
         return "%s %s" % (

Modified: Zope3/trunk/src/zope/app/form/browser/itemswidgets.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/itemswidgets.py	2004-12-23 18:26:32 UTC (rev 28692)
+++ Zope3/trunk/src/zope/app/form/browser/itemswidgets.py	2004-12-23 21:06:23 UTC (rev 28693)
@@ -437,7 +437,7 @@
                              name=name,
                              id=id,
                              cssClass=cssClass,
-                             checked=None,
+                             checked="checked",
                              type='radio')
         return self._joinButtonToMessageTemplate %(elem, text)
 
@@ -502,7 +502,7 @@
         rendered_items = self.renderItems(value)
         return renderElement(self.tag,
                              name=self.name + ':list',
-                             multiple=None,
+                             multiple='multiple',
                              size=self.size,
                              contents="\n".join(rendered_items),
                              extra=self.extra)
@@ -586,6 +586,6 @@
                              name=name,
                              id=id,
                              value=value,
-                             checked=None)
+                             checked="checked")
         return self._joinButtonToMessageTemplate %(elem, text)
 

Modified: Zope3/trunk/src/zope/app/form/browser/widget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/widget.py	2004-12-23 18:26:32 UTC (rev 28692)
+++ Zope3/trunk/src/zope/app/form/browser/widget.py	2004-12-23 21:06:23 UTC (rev 28693)
@@ -35,6 +35,8 @@
 from zope.app.form.browser.interfaces import ISimpleInputWidget
 from zope.app.form.browser.interfaces import IWidgetInputErrorView
 
+import warnings
+
 class BrowserWidget(Widget, BrowserView):
     """Base class for browser widgets.
 
@@ -442,6 +444,13 @@
         items.sort()
         for key, value in items:
             if value == None:
+                warnings.warn(
+                    "None was passed for attribute %r.  Passing None "
+                    "as attribute values to renderTag is deprecated. "
+                    "Passing None as an attribute value will be disallowed "
+                    "starting in Zope 3.3."
+                    % key,
+                    DeprecationWarning, stacklevel=2)
                 value = key
             attr_list.append(u'%s=%s' % (key, quoteattr(unicode(value))))
 



More information about the Zope3-Checkins mailing list