[Zope-dev] ZPublisher: using zope.formlib and z3c.form in Zope 2

yuppie y.2011 at wcm-solutions.de
Wed Mar 2 03:43:01 EST 2011


Hi!


ZPublisher.Publish and zope.publisher.publish process form inputs 
differently. Zope 2 returns encoded strings unchanged if no converters 
are specified. zope.publisher converts encoded strings to unicode.

One major reason why zope.formlib and z3c.form can't be used directly in 
Zope 2 is the fact they expect decoded form values. five.formlib uses 
special base classes and plone.z3cform monkey patches the base classes 
in z3c.form.


Proposal:

- Products.Five.browser.decode should be moved to ZPublisher. 
processInputs and setPageEncoding are publisher related code.

- After traversal and before calling the object 
ZPublisher.Publish.publish should figure out if the object expects 
zope.publisher behavior. Either we use a new interface for this or we 
use zope.publisher.interfaces.browser.IBrowserPage: AFAICS in Zope 2 
land only zope.formlib and z3c.form based views implement IBrowserPage.

- If the object implements that interface, the request is post processed 
using processInputs and setPageEncoding.

- plone.z3cform uses a modified version of processInputs and doesn't use 
setPageEncoding. Can anybody explain why? I guess that are no z3c.form 
specific reasons. Maybe the changes can be merged back to Zope?


Does that make sense? I guess that kind of change should only be made on 
the trunk.


Cheers,

	Yuppie



More information about the Zope-Dev mailing list