[z3-five] Re: [Archetypes-devel] Future of Archetypes
Philipp von Weitershausen
philipp at weitershausen.de
Sat Sep 11 16:57:58 MEST 2004
Sidnei da Silva wrote:
> On Sat, Sep 11, 2004 at 03:30:39PM +0200, Martijn Faassen wrote:
> | Jean Rodrigo Ferri wrote:
> | [snip]
> |
> | >Humm, it was exactly what I was thinking. Then the future of Archetypes
> | >is a fusion with Z3, desapearing gradually, seemingly without trauma!
> |
> | Note that I heard that Ben Saller may have other plans in mind for the
> | future of Archetypes, called version 2. I don't know exactly what these
> | plans are -- there was a talk at EuroPython last june but I didn't get
> | to attend it. I'm not a good person to talk to about archetypes itself,
> | as I'm not one of the developers. Ben, and Sidnei, are. I'm the Zope 2
> | -> Zope 3 guy, myself.
>
> The main issue is that Zope 3 schemas are not rich enough to provide
> all the features that Archetypes does. As Paul noted in some other
> thread, it is rather complex to control UI information with Z3
> schemas, because though they provide some hints for form rendering,
> those hints are not enough to do it all.
>
> Turning views into multiadapters is a step closer to filling this gap.
You are right that Archetypes schemas do more than Zope3 schemas. This
is not necessarily a good thing. For example, declaring the rendering
widget inside an AT schema hurts my understanding of separation of
content and presentation.
In Zope3, we achieve the same complexity that AT schemas have with many
different components that are somewhat loosely tied together. You have
the object itself that provides a schema or can be adapted to it. The
schema has fields describing the object's data (or the adapter's),
widgets that operate on the object using the field's constraint
information, and an editing or adding view that ties all widgets together.
As you can tell, we are very sensitive about which component is
reponsible for what in Zope3. While it seems like unnecessary complexity
now, you'll love it when you have to replace a component with a custom
implementation. In Five, for example, we rely on that very feature
because we have to override some core components of the Zope3
architecture so that they work in Zope 2.
> The migration, as I see it would be sort of like Tres's 'bridge'
> thing, that bridges Z2 interfaces to Z3 interfaces. From there on, we
> could experiment with Z3 widgets as replacements for Archetypes
> widgets. That's it, as far as I can see.
>
> I imagine the flow being something like this:
>
> - Declare an Archetypes schema on the class
> - Use a at:schema directive to building a z3 schema from the at one
> and at the same time register a generic adapter from z3 schema to at
> schema
> - Have a browser:addform and browser:editform be generated from a
> at:forms or something like that
>
> This would get us with a Zope 3 view on a Zope 3 schema. Then, editing
> would be like:
>
> - User submits form
> - Z3 processes widgets, extracting values and doing validation
> - Z3 gets an adapter from object to Z3 schema
> - The adapter found is the generic one registered with at:schema above
> - The adapter would use Archetypes Fields api for storing the data
>
> That would take care of the general case.
This sounds like a sensible way to go.
> Other than this, I would really like to see events being used for all
> sorts of things, like validation, references, transforms. Archetypes
> validators could be hooked as subscribers for a IValidation event when
> Z3 is processing widgets after a form submission, etc.
Note that there won't be an event sent but you can implement
subscription adapters that provide to IValidator. They are subscribed by
widgets and will be called for validation. See NoMoreSchemaBinding
(http://dev.zope.org/Zope3/NoMoreSchemaBinding) for the proposal.
Philipp
More information about the z3-five
mailing list