[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/form/browser/source. fix XHTML-ishness of the source widgets

Fred L. Drake, Jr. fdrake at gmail.com
Thu Jul 21 17:28:30 EDT 2005


Log message for revision 37374:
  fix XHTML-ishness of the source widgets

Changed:
  U   Zope3/trunk/src/zope/app/form/browser/source.py
  U   Zope3/trunk/src/zope/app/form/browser/source.txt

-=-
Modified: Zope3/trunk/src/zope/app/form/browser/source.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/source.py	2005-07-21 19:48:17 UTC (rev 37373)
+++ Zope3/trunk/src/zope/app/form/browser/source.py	2005-07-21 21:28:30 UTC (rev 37374)
@@ -15,7 +15,6 @@
 
 $Id$
 """
-import cgi
 import xml.sax.saxutils
 
 import zope.schema.interfaces
@@ -174,8 +173,8 @@
             # it as if it was missing and return nothing.
             return ''
                 
-        return ('<input type="hidden" name="%s" value="%s">'
-                % (self.name, cgi.escape(term.token))
+        return ('<input type="hidden" name="%s" value=%s />'
+                % (self.name, xml.sax.saxutils.quoteattr(term.token))
                 )
 
     def error(self):
@@ -226,10 +225,11 @@
                 result.append(u'     ' + self.renderTermForDisplay(term))
                 result.append('    </div>')
                 result.append('  </div>')
-                result.append('  <input type="hidden" name="%s" value="%s">'
-                              % (self.name, cgi.escape(term.token)))
+                result.append(
+                    '  <input type="hidden" name="%s" value=%s />'
+                    % (self.name, xml.sax.saxutils.quoteattr(term.token)))
 
-        result.append('  <input type="hidden" name="%s.displayed" value="y">'
+        result.append('  <input type="hidden" name="%s.displayed" value="y" />'
                       % self.name)
         
         result.append('  <div class="queries">')
@@ -261,7 +261,7 @@
             '<select name="%s.selection">\n'
             '%s\n'
             '</select>\n'
-            '<input type="submit" name="%s.apply" value="%s">'
+            '<input type="submit" name="%s.apply" value="%s" />'
             % (name,
                '\n'.join(
                    [('<option value="%s">%s</option>'
@@ -399,9 +399,10 @@
                 # it as if it was missing and skip
                 continue
             else:
-                result.append('<input type="hidden" name="%s:list" value="%s">'
-                              % (self.name, cgi.escape(term.token))
-                              )
+                result.append(
+                    '<input type="hidden" name="%s:list" value=%s />'
+                    % (self.name, xml.sax.saxutils.quoteattr(term.token))
+                    )
 
     def __call__(self):
         result = ['<div class="value">']
@@ -417,24 +418,24 @@
                 else:
                     result.append(
                         '  <input type="checkbox" name="%s.checked:list"'
-                        ' value="%s">'
-                        % (self.name, cgi.escape(term.token))
+                        ' value=%s />'
+                        % (self.name, xml.sax.saxutils.quoteattr(term.token))
                         )
                     result.append('  ' + self.renderTermForDisplay(term))
                     result.append(
-                        '  <input type="hidden" name="%s:list" value="%s">'
-                        % (self.name, cgi.escape(term.token)))
-                    result.append('  <br>')
+                        '  <input type="hidden" name="%s:list" value=%s />'
+                        % (self.name, xml.sax.saxutils.quoteattr(term.token)))
+                    result.append('  <br />')
 
             result.append(
-                '  <input type="submit" name="%s.remove" value="%s">'
+                '  <input type="submit" name="%s.remove" value="%s" />'
                 % (self.name,
                    self._translate(_("MultipleSourceInputWidget-remove",
                                      default="Remove")))
                 )
-            result.append('  <br>')
+            result.append('  <br />')
 
-        result.append('  <input type="hidden" name="%s.displayed" value="y">'
+        result.append('  <input type="hidden" name="%s.displayed" value="y" />'
                       % self.name)
         
         result.append('  <div class="queries">')
@@ -468,7 +469,7 @@
             '<select name="%s.selection:list" multiple>\n'
             '%s\n'
             '</select>\n'
-            '<input type="submit" name="%s.apply" value="%s">'
+            '<input type="submit" name="%s.apply" value="%s" />'
             % (name,
                '\n'.join([('<option value="%s">%s</option>' % (token, title))
                           for (title, token) in terms]),

Modified: Zope3/trunk/src/zope/app/form/browser/source.txt
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/source.txt	2005-07-21 19:48:17 UTC (rev 37373)
+++ Zope3/trunk/src/zope/app/form/browser/source.txt	2005-07-21 21:28:30 UTC (rev 37374)
@@ -135,7 +135,7 @@
        Nothing
       </div>
     </div>
-    <input type="hidden" name="field.dog.displayed" value="y">
+    <input type="hidden" name="field.dog.displayed" value="y" />
     <div class="queries">
       <div class="query">
         <div class="queryinput">
@@ -195,7 +195,7 @@
        Nothing
       </div>
     </div>
-    <input type="hidden" name="field.dog.displayed" value="y">
+    <input type="hidden" name="field.dog.displayed" value="y" />
     <div class="queries">
       <div class="query">
         <div class="queryinput">
@@ -207,7 +207,7 @@
   <option value="Ym93c2Vy">bowser</option>
   <option value="c3BvdA==">spot</option>
   </select>
-  <input type="submit" name="field.dog.query.apply" value="Apply">
+  <input type="submit" name="field.dog.query.apply" value="Apply" />
         </div> <!-- queryresults -->
       </div> <!-- query -->
     </div> <!-- queries -->
@@ -233,8 +233,8 @@
        spot
       </div>
     </div>
-    <input type="hidden" name="field.dog" value="c3BvdA==">
-    <input type="hidden" name="field.dog.displayed" value="y">
+    <input type="hidden" name="field.dog" value="c3BvdA==" />
+    <input type="hidden" name="field.dog.displayed" value="y" />
     <div class="queries">
       <div class="query">
         <div class="queryinput">
@@ -317,7 +317,7 @@
        Nothing
       </div>
     </div>
-    <input type="hidden" name="field.pet.displayed" value="y">
+    <input type="hidden" name="field.pet.displayed" value="y" />
     <div class="queries">
       <div class="query">
         <div class="queryinput">
@@ -352,7 +352,7 @@
        Nothing
       </div>
     </div>
-    <input type="hidden" name="field.pet.displayed" value="y">
+    <input type="hidden" name="field.pet.displayed" value="y" />
     <div class="queries">
       <div class="query">
         <div class="queryinput">
@@ -372,7 +372,7 @@
   <option value="dGlnZXI=">tiger</option>
   <option value="dG9t">tom</option>
   </select>
-  <input type="submit" name="field.pet.MQ__.apply" value="Apply">
+  <input type="submit" name="field.pet.MQ__.apply" value="Apply" />
         </div> <!-- queryresults -->
       </div> <!-- query -->
     </div> <!-- queries -->
@@ -398,8 +398,8 @@
        tabby
       </div>
     </div>
-    <input type="hidden" name="field.pet" value="dGFiYnk=">
-    <input type="hidden" name="field.pet.displayed" value="y">
+    <input type="hidden" name="field.pet" value="dGFiYnk=" />
+    <input type="hidden" name="field.pet.displayed" value="y" />
     <div class="queries">
       <div class="query">
         <div class="queryinput">
@@ -461,7 +461,7 @@
 
   >>> print widget()
   <div class="value">
-    <input type="hidden" name="field.pets.displayed" value="y">
+    <input type="hidden" name="field.pets.displayed" value="y" />
     <div class="queries">
       <div class="query">
         <div class="queryinput">
@@ -493,7 +493,7 @@
 
   >>> print widget()
   <div class="value">
-    <input type="hidden" name="field.pets.displayed" value="y">
+    <input type="hidden" name="field.pets.displayed" value="y" />
     <div class="queries">
       <div class="query">
         <div class="queryinput">
@@ -513,7 +513,7 @@
   <option value="dGlnZXI=">tiger</option>
   <option value="dG9t">tom</option>
   </select>
-  <input type="submit" name="field.pets.MQ__.apply" value="Apply">
+  <input type="submit" name="field.pets.MQ__.apply" value="Apply" />
         </div> <!-- queryresults -->
       </div> <!-- query -->
     </div> <!-- queries -->
@@ -532,21 +532,21 @@
 
   >>> print widget()
   <div class="value">
-    <input type="checkbox" name="field.pets.checked:list" value="dGFiYnk=">
+    <input type="checkbox" name="field.pets.checked:list" value="dGFiYnk=" />
     tabby
-    <input type="hidden" name="field.pets:list" value="dGFiYnk=">
-    <br>
-    <input type="checkbox" name="field.pets.checked:list" value="dGlnZXI=">
+    <input type="hidden" name="field.pets:list" value="dGFiYnk=" />
+    <br />
+    <input type="checkbox" name="field.pets.checked:list" value="dGlnZXI=" />
     tiger
-    <input type="hidden" name="field.pets:list" value="dGlnZXI=">
-    <br>
-    <input type="checkbox" name="field.pets.checked:list" value="dG9t">
+    <input type="hidden" name="field.pets:list" value="dGlnZXI=" />
+    <br />
+    <input type="checkbox" name="field.pets.checked:list" value="dG9t" />
     tom
-    <input type="hidden" name="field.pets:list" value="dG9t">
-    <br>
-    <input type="submit" name="field.pets.remove" value="Remove">
-    <br>
-    <input type="hidden" name="field.pets.displayed" value="y">
+    <input type="hidden" name="field.pets:list" value="dG9t" />
+    <br />
+    <input type="submit" name="field.pets.remove" value="Remove" />
+    <br />
+    <input type="hidden" name="field.pets.displayed" value="y" />
     <div class="queries">
       <div class="query">
         <div class="queryinput">
@@ -580,13 +580,13 @@
 
   >>> print widget()
   <div class="value">
-    <input type="checkbox" name="field.pets.checked:list" value="dGlnZXI=">
+    <input type="checkbox" name="field.pets.checked:list" value="dGlnZXI=" />
     tiger
-    <input type="hidden" name="field.pets:list" value="dGlnZXI=">
-    <br>
-    <input type="submit" name="field.pets.remove" value="Remove">
-    <br>
-    <input type="hidden" name="field.pets.displayed" value="y">
+    <input type="hidden" name="field.pets:list" value="dGlnZXI=" />
+    <br />
+    <input type="submit" name="field.pets.remove" value="Remove" />
+    <br />
+    <input type="hidden" name="field.pets.displayed" value="y" />
     <div class="queries">
       <div class="query">
         <div class="queryinput">



More information about the Zope3-Checkins mailing list