[Zope3-Users] Problem with z3c.form / z3c.formui packages
Thierry Florac
tflorac at ulthar.net
Fri Mar 14 19:22:22 EDT 2008
Hi,
On ven, 2008-03-14 at 23:12 +0100, Thierry Florac wrote:
> I'm trying to use a few z3c.* packages to build a little test
> application : z3c.form, z3c.formui, z3c.layout, z3c.pagelet...
>
> What I've done until now is :
> - create a custom layer :
> class ITestLayer(z3c.form.interfaces.IFormLayer,
> z3c.layer.pagelet.IPageletBrowserLayer)
>
> - create a custom skin based on this layer :
> class ITestSkin(z3c.formui.interfaces.IDivFormLayer,
> ITestLayer)
>
> - create a pagelet based layout for my skin (via z3c.layout)
>
> - create an add form, a display form and an edit form for my custom
> content :
> class TestAddForm(z3c.formui.form.AddForm)
> class TestDisplayForm(z3c.formui.form.DisplayForm)
> class TestEditForm(z3c.formui.form.EditForm)
>
> - declare these forms as pagelets (via z3c.pagelet)
>
> Until now, everything is OK : I've created a set of custom widgets that
> I can display without any problem in the different modes, and these
> forms work perfectly.
>
> My problem is that I would like to modify the default form template,
> actually provided by z3c.formui template 'div-form.pt' ; so I've created
> a new template, but I can't use it : I've tried to register it via
> several ZCML directives (z3c.template...), but none of them is OK and my
> custom template is never used !
I'm replying to my own message after a short discussion on IRC with
Stephan Richter, for anybody which would be interested in the answer...
The problem is coming from the ITestSkin interface, which was inheriting
from IDivFormLayer : actually, IDivFormLayer benefit is to provide a
ready to use div-based form layout ; so if your goal (like for me in
this example) is just to override this layout template, inheriting from
IDivFormLayer doesn't make any sense.
Problem was finally solved with the following statements :
class ITestSkin(z3c.formui.interfaces.IFormUILayer,ITestLayer):
...
<z3c:template
for="z3c.form.interfaces.IInputForm"
template="mydiv-form.pt"
layer=".ITestLayer" />
Many thanks,
Thierry
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the Zope3-users
mailing list