ZPublisher: using zope.formlib and z3c.form in Zope 2

yuppie <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
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

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.