_patch.py in PloneGetPaid breaks Five formbased forms everywhere

3 views
Skip to first unread message

Matt Halstead

unread,
Oct 22, 2008, 10:18:02 PM10/22/08
to getpaid-dev

see http://code.google.com/p/getpaid/source/detail?spec=svn2096&r=1315

1) I don't think the patch does what it intends to do
2) the way it is written kills unicode support for all Five formbase
based forms

in the code it says:

------------------

REQUEST INPUT PROCESSING

five destructively processes list and tuple inputs, when converting to
unicode
so we patch it to only happen once in the request.

-------------------

then the patch

-------------------------

from Products.Five.formlib.formbase import FiveFormlibMixin
from Products.Five.browser import decode

def update( self ):
if getattr( self.request, '__inputs_processed', False ):
decode.processInputs( self.request )
decode.setPageEncoding( self.request )
request.__inputs_processed = True
super( FiveFormlibMixin, self).update()

FiveFormlibMixin.update = update


------------------------

my interpretation is that line 40 (http://code.google.com/p/getpaid/
source/browse/trunk/products/PloneGetPaid/_patch.py?
spec=svn2096&r=1315#40) should be:

if not getattr( self.request, '__inputs_processed', False ):

cheers
Matt


Kapil Thangavelu

unread,
Oct 23, 2008, 12:06:27 AM10/23/08
to getpa...@googlegroups.com
On Wed, Oct 22, 2008 at 10:18 PM, Matt Halstead <matt.h...@gmail.com> wrote:


see http://code.google.com/p/getpaid/source/detail?spec=svn2096&r=1315

1) I don't think the patch does what it intends to do

agreed, it certainly looks odd, and your change sounds good. the intent was clearly that it should be executing once and only once, and that's the whole purpose for it. the issue was on any z3 form processing a list it would, attempt to decode a list of values twice, which occurred with multiple formlib viewlets in the admin.  otoh, if people haven't been reporting any issues with unicode list processing, or a decode error in particular, than perhaps the whole patch can just be removed.

cheers,

kapil

Reply all
Reply to author
Forward
0 new messages