[Checkins] SVN: Products.Five/branches/1.5/ forward ported r70913 from 1.4 branch:

Yvo Schubbe y.2006_ at wcm-solutions.de
Wed Oct 25 15:30:09 EDT 2006


Log message for revision 70914:
  forward ported r70913 from 1.4 branch:
  - processInputs did not decode strings in lists and tuples

Changed:
  U   Products.Five/branches/1.5/CHANGES.txt
  UU  Products.Five/branches/1.5/browser/decode.py
  A   Products.Five/branches/1.5/browser/tests/test_decode.py

-=-
Modified: Products.Five/branches/1.5/CHANGES.txt
===================================================================
--- Products.Five/branches/1.5/CHANGES.txt	2006-10-25 19:20:28 UTC (rev 70913)
+++ Products.Five/branches/1.5/CHANGES.txt	2006-10-25 19:30:03 UTC (rev 70914)
@@ -5,6 +5,8 @@
 Five 1.5.1 (unreleased)
 =======================
 
+* browser: processInputs now decodes strings in lists and tuples.
+
 * formlib: Removed redundant subpageform.pt and pageform.pt. Added missing
   error view configuration.
 

Modified: Products.Five/branches/1.5/browser/decode.py
===================================================================
--- Products.Five/branches/1.5/browser/decode.py	2006-10-25 19:20:28 UTC (rev 70913)
+++ Products.Five/branches/1.5/browser/decode.py	2006-10-25 19:30:03 UTC (rev 70914)
@@ -13,6 +13,8 @@
 ##############################################################################
 """ Utility functions for decoding browser input and setting the output
     encoding.
+
+$Id$
 """
 
 from zope.publisher.browser import isCGI_NAME
@@ -34,11 +36,19 @@
     if charsets is None:
         envadapter = IUserPreferredCharsets(request)
         charsets = envadapter.getPreferredCharsets() or ['utf-8']
-    
+
     for name, value in request.form.items():
-        if (not (isCGI_NAME(name) or name.startswith('HTTP_'))
-            and isinstance(value, str)):
-            request.form[name] = _decode(value, charsets)
+        if not (isCGI_NAME(name) or name.startswith('HTTP_')):
+            if isinstance(value, str):
+                request.form[name] = _decode(value, charsets)
+            elif isinstance(value, list):
+                request.form[name] = [ _decode(val, charsets)
+                                       for val in value
+                                       if isinstance(val, str) ]
+            elif isinstance(value, tuple):
+                request.form[name] = tuple([ _decode(val, charsets)
+                                             for val in value
+                                             if isinstance(val, str) ])
 
 def setPageEncoding(request):
     """Set the encoding of the form page via the Content-Type header.


Property changes on: Products.Five/branches/1.5/browser/decode.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Copied: Products.Five/branches/1.5/browser/tests/test_decode.py (from rev 70913, Products.Five/branches/1.4/browser/tests/test_decode.py)



More information about the Checkins mailing list