[zope2-tracker] [Bug 751586] [NEW] request encoding in five.formlib
samuel or tell me sam
751586 at bugs.launchpad.net
Tue Apr 5 12:00:21 EDT 2011
Public bug reported:
hi all,
I use five.formlib with plone 4. i found that the request is transformed
to unicode but never restored at the end of rendering a template. If
some code depends on the request after rendering the formlib template it
will break.
All in all this seems dangerous to me, is there another way to
accomplish this?
Regards, sam
Raptus AG
the following hack works for me, but looks ugly:
--- src/five.formlib/src/five/formlib/formbase.py (revision 121284)
+++ src/five.formlib/src/five/formlib/formbase.py (working copy)
@@ -47,10 +47,15 @@
# BBB: for CMFDefault < 2.3 (explicit charset required)
self.request.RESPONSE.setHeader('Content-Type',
'text/html; charset=%s' % HTTPRequest.default_encoding)
+
+ # only change a copy from form to unicode and restore it at the end.
+ old_request_form = self.request.form
+ self.request.form = self.request.form.copy()
# BBB: for Zope < 2.14
if not getattr(self.request, 'postProcessInputs', False):
processInputs(self.request, [HTTPRequest.default_encoding])
super(FiveFormlibMixin, self).update()
+ self.request.form = old_request_form
class FormBase(FiveFormlibMixin, form.FormBase):
** Affects: five.formlib
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Zope 2
Developers, which is the registrant for five.formlib.
https://bugs.launchpad.net/bugs/751586
Title:
request encoding in five.formlib
More information about the zope2-tracker
mailing list