[Zope3-checkins] SVN: Zope3/trunk/ Fixes for bugs 443 and 468 (one fix, two bugs squashed): wrong unescaping of xml/html data in widgets

Christian Theune ct at gocept.com
Fri Dec 2 09:37:21 EST 2005


Log message for revision 40473:
  Fixes for bugs 443 and 468 (one fix, two bugs squashed): wrong unescaping of xml/html data in widgets
  

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/app/form/browser/textwidgets.py
  U   Zope3/trunk/src/zope/app/rotterdam/editingwidgets.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2005-12-02 14:35:08 UTC (rev 40472)
+++ Zope3/trunk/doc/CHANGES.txt	2005-12-02 14:37:21 UTC (rev 40473)
@@ -162,6 +162,9 @@
 
     Bug Fixes
 
+      - Fixed bugs 468 and 443: Invalid escaping of xml/html data on ZPT pages
+        and text/* files.
+
       - Fixed a bug in adapter registrations that caused errors and
         lookup failures when specifications had multiple base
         specifications.
@@ -229,7 +232,7 @@
       Stephan Richter, Roger Ineichen, Marius Gedminas, Julien Anguenot, Benji
       York, Gary Poster, Jim Fulton, Michael Kerrin, Torsten Kurbad,
       Philipp von Weitershausen, Tarek Ziadé, Andreas Jung, Dmitry Vasiliev,
-      Juergen Kartnaller, Stefan Holek, Dominik Huber
+      Juergen Kartnaller, Stefan Holek, Dominik Huber, Christian Theune
 
     Note: If you are not listed and contributed, please add yourself. This
           note will be deleted before the release.

Modified: Zope3/trunk/src/zope/app/form/browser/textwidgets.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/textwidgets.py	2005-12-02 14:35:08 UTC (rev 40472)
+++ Zope3/trunk/src/zope/app/form/browser/textwidgets.py	2005-12-02 14:37:21 UTC (rev 40473)
@@ -35,12 +35,6 @@
         str = saxutils.escape(str)
     return str
 
-def unescape(str):
-    if str is not None:
-        str = saxutils.unescape(str)
-    return str
-
-
 class TextWidget(SimpleInputWidget):
     """Text widget.
 
@@ -94,7 +88,7 @@
     Check that HTML is correctly encoded and decoded:
 
     >>> request = TestRequest(
-    ...     form={'field.foo': u'<h1>©</h1>'})
+    ...     form={'field.foo': u'<h1>&copy;</h1>'})
     >>> widget = TextWidget(field, request)
     >>> widget.getInputValue()
     u'<h1>&copy;</h1>'
@@ -152,7 +146,7 @@
                 value = unicode(input)
             except ValueError, v:
                 raise ConversionError(_("Invalid text data"), v)
-        return unescape(value)
+        return value
 
 
 class Bytes(SimpleInputWidget):
@@ -280,7 +274,7 @@
     Check that HTML is correctly encoded and decoded:
 
     >>> request = TestRequest(
-    ...     form={'field.foo': u'&lt;h1&gt;&amp;copy;&lt;/h1&gt;'})
+    ...     form={'field.foo': u'<h1>&copy;</h1>'})
     >>> widget = TextAreaWidget(field, request)
     >>> widget.getInputValue()
     u'<h1>&copy;</h1>'
@@ -308,7 +302,6 @@
             except ValueError, v:
                 raise ConversionError(_("Invalid unicode data"), v)
             else:
-                value = unescape(value)
                 value = value.replace("\r\n", "\n")                
         return value
 

Modified: Zope3/trunk/src/zope/app/rotterdam/editingwidgets.py
===================================================================
--- Zope3/trunk/src/zope/app/rotterdam/editingwidgets.py	2005-12-02 14:35:08 UTC (rev 40472)
+++ Zope3/trunk/src/zope/app/rotterdam/editingwidgets.py	2005-12-02 14:37:21 UTC (rev 40473)
@@ -75,7 +75,7 @@
     Check that HTML is correctly encoded and decoded:
 
     >>> request = TestRequest(
-    ...     form={'field.foo': u'&lt;h1&gt;&amp;copy;&lt;/h1&gt;'})
+    ...     form={'field.foo': u'<h1>&copy;</h1>'})
     >>> widget = SimpleEditingWidget(field, request)
     >>> widget.style = ''
     >>> widget.getInputValue()



More information about the Zope3-Checkins mailing list