[Zope-Checkins] SVN: Products.Five/trunk/ forward ported r70913
from 1.4 branch:
Yvo Schubbe
y.2006_ at wcm-solutions.de
Wed Oct 25 15:34:19 EDT 2006
Log message for revision 70915:
forward ported r70913 from 1.4 branch:
- processInputs did not decode strings in lists and tuples
Changed:
U Products.Five/trunk/CHANGES.txt
UU Products.Five/trunk/browser/decode.py
A Products.Five/trunk/browser/tests/test_decode.py
-=-
Modified: Products.Five/trunk/CHANGES.txt
===================================================================
--- Products.Five/trunk/CHANGES.txt 2006-10-25 19:30:03 UTC (rev 70914)
+++ Products.Five/trunk/CHANGES.txt 2006-10-25 19:34:18 UTC (rev 70915)
@@ -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/trunk/browser/decode.py
===================================================================
--- Products.Five/trunk/browser/decode.py 2006-10-25 19:30:03 UTC (rev 70914)
+++ Products.Five/trunk/browser/decode.py 2006-10-25 19:34:18 UTC (rev 70915)
@@ -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/trunk/browser/decode.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Copied: Products.Five/trunk/browser/tests/test_decode.py (from rev 70913, Products.Five/branches/1.4/browser/tests/test_decode.py)
More information about the Zope-Checkins
mailing list