Hi there,
I've been trying to clean up the zope.formlib/zope.app.form situation. This is a report about my lack of progress so far, just so I have something to show for it. :)
zope.app.form is in practice in use as a widget library for zope.formlib. It however also contains code that supports the original Zope 3 form system (using ZCML directives).
My first response was to try to move zope.app.form's widgets into zope.formlib. zope.app.form can then depend on zope.formlib for its widgets (for backwards compatibility), and zope.formlib would stop depending on zope.app.form. We can leave the old Zope 3 form system behind.
I started to try this but was daunted by having to port a huge amount of code from zope.app.form to zope.formlib, including test code.
Instead, I tried to create a zope.formlibwidget which which would contain only the widgets of zope.app.form. zope.app.form would then depend on it for backwards compatibility, and zope.formlib would only need to depend on zope.formlibwidget.
Unfortunately this bounced off the fact that zope.app.form's functional widget tests (there are many, we want to retain them) depend on the old Zope 3 form support in order to do their tests. The old Zope 3 form support I was trying to get rid of in the first place.
To do sane functional tests I need a form library. I can't use zope.formlib in zope.formlibwidget as that would create a circular dependency (at least for tests, but that's ugly enough).
So my conclusion is to move zope.app.form's widget stuff into zope.formlib, so that the functional tests can be ported to use zope.formlib instead of the old Zope 3 form system.
So I'm back to my original approach again...
Regards,
Martijn
Hey,
Martijn Faassen wrote:
So I'm back to my original approach again...
This approach is working; I've moved the widget implementations and most tests from zope.app.form into zope.formlib now. zope.formlib has no more dependency on zope.app.form anymore either, instead zope.app.form depends on zope.formlib.
There are still some functional tests to port and this is a bit more tricky. Hopefully I (or someone else) will get around to it soon.
I'm talking about the test_functional_* tests in zope.app.form.browser.tests. Not of all of them are sensibly portable to zope.formlib, but the widget-related ones are. I have a few examples of ported versions already in zope.formlib.tests.
Regards,
Martijn
On 12/31/2009 01:52 AM, Martijn Faassen wrote:
Hey,
Martijn Faassen wrote:
So I'm back to my original approach again...
This approach is working; I've moved the widget implementations and most tests from zope.app.form into zope.formlib now. zope.formlib has no more dependency on zope.app.form anymore either, instead zope.app.form depends on zope.formlib.
Sounds about right to me. :)
I'm actually happy seeing those cleaned up -- as much as I like z3c.form I do tend to go with formlib here and there because it's a well known area to me. :)
Christian
On Thu, Dec 31, 2009 at 01:52:48AM +0100, Martijn Faassen wrote:
Martijn Faassen wrote:
So I'm back to my original approach again...
This approach is working; I've moved the widget implementations and most tests from zope.app.form into zope.formlib now. zope.formlib has no more dependency on zope.app.form anymore either, instead zope.app.form depends on zope.formlib.
Woohoo!
Marius Gedminas
Am 30.12.2009, 19:06 Uhr, schrieb Martijn Faassen faassen@startifact.com:
To do sane functional tests I need a form library. I can't use zope.formlib in zope.formlibwidget as that would create a circular dependency (at least for tests, but that's ugly enough). So my conclusion is to move zope.app.form's widget stuff into zope.formlib, so that the functional tests can be po
Hi Maartijn,
this does sound like a sensible approach - from the work I've done with formlib I can confirm that I never understood what was formlib and what was zope.app.form. One small question - what do I need to do to get this work with Zope 2.12? Currently I have to peg to < 4.0.0 Otherwise I get the following error:
zope.configuration.config.ConfigurationConflictError: Conflicting configuration actions For: ('adapter', (<InterfaceClass zope.formlib.interfaces.IAction>,), <InterfaceClass zope.browserpage.namedtemplate.INamedTemplate>, u'render') File "/Users/charlieclark/Sites/zurich/eggs/zope.formlib-4.0-py2.6.egg/zope/formlib/configure.zcml", line 19.2-19.64 <adapter factory=".form.render_submit_button" name="render" /> File "/Users/charlieclark/Sites/zurich/eggs/Zope2-2.12.2-py2.6-macosx-10.6-i386.egg/Products/Five/formlib/configure.zcml", line 6.2-9.8 <adapter factory=".form.render_submit_button" name="render" /> For: ('adapter', (<class 'zope.interface.exceptions.Invalid'>, <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>), <InterfaceClass zope.formlib.interfaces.IWidgetInputErrorView>, '') File "/Users/charlieclark/Sites/zurich/eggs/zope.formlib-4.0-py2.6.egg/zope/formlib/configure.zcml", line 22.2-25.8 <adapter factory=".errors.InvalidErrorView" permission="zope.Public" /> File "/Users/charlieclark/Sites/zurich/eggs/Zope2-2.12.2-py2.6-macosx-10.6-i386.egg/Products/Five/formlib/configure.zcml", line 12.2-17.8 <adapter for="zope.interface.Invalid zope.publisher.interfaces.browser.IBrowserRequest" factory=".errors.InvalidErrorView" permission="zope.Public" />
Charlie