[Zope3-Users] Re: Generate view for adapted interface
Philipp von Weitershausen
philipp at weitershausen.de
Sun Jun 11 18:19:47 EDT 2006
Achim Domma wrote:
> I'm implementing an annotations adapter following the "IRatbble" example
> in Philips book. Now I want to have a "Dublin Core" like edit view in ZMI.
>
> The most simple solution seems to be to register a view for the original
> interface. In this view I would adapt the context object and would then
> use formlib to generate the forms automaticaly.
>
> But I wonder if this could be done in a declarative way in ZCML.
> Something like "register edit view for IInterfaceA, but adapt it to
> IInterfaceB and create view for this interface".
No, ZCML is just for registering things, e.g. a browser page. It doesn't
really want to know what your browser page does. And a zope.formlib page
form (e.g. an EditForm) is just another browser page to ZCML.
zope.formlib will automatically adapt your object to the form interface
if it doesn't provide it. So, when you have form for IMyObject that uses
form fields from, say, IDublinCore, it will automatically adapt your
object to IDublinCore and save the modifications on the adapter.
Philipp
More information about the Zope3-users
mailing list