[Framework-Team] Re: AT Schema and Zope 3 [was: Re: Login redirect in 3.0?]

Martin Aspeli optilude at gmx.net
Thu Dec 28 14:58:29 UTC 2006

Florian Schulze wrote:

>> On the other hand, if we don't mind ATCT depending on 
>> plone.app.redirector, we can do this the usual way, with a write-only 
>> field and a custom mutator.
> I just looked at the source, so I might be wrong. AFAICS there are two 
> problems:
> 1. If we want to change something in the Schema globaly, then we have to 
> overwrite the adapter from BaseObject to ISchema. Overwrites shouldn't 
> be used in a framework though.

We don't need it to be global. It can be an ATCT feature, that you can 
mix into your own objects as needed. It doesn't make sense e.g. to have 
this on an issue tracker issue or whatever, it only really makes sense 
for first-order content.

> 2. AT expects the mutators to be available in the context. I'm not 
> really sure about this.
> Let's see how we could to the alias stuff:
>  - We either overwrite the adapter from BaseObject to ISchema or use a 
> more explicit one from the ATCT base object (which would make it work 
> for ATCT types only).
>  - In the new adapter we return the original Schema plus the new fields 
> for the alias stuff
>  - When the form is saved BaseObject._processForm iterates over all the 
> fields of the Schema, gets the widget, calls widget.processForm, then 
> gets field.getMutator and calls it
>  - To make this work we return our own field with our own widget and 
> mutator

Take a look at ContentFlavors. It basically builds a schema dynamically, 
on a per-object basis (there are good reasons for this).

Here, though, it may as well be a specific field in ATCT, with a mixin 
class or using an existing mixin class.

> I think what's missing here is a way to provide an adapter from 
> BaseObject to ISchema which is extendable by products. Maybe we could 
> make archetypes_tool a local utility and provide a way to register 
> additional Schema parts. I currently have no real idea how this could 
> work properly. Maybe we should also use interfaces for Fields and 
> Widgets in _processForm to make this more flexible.

Look at ContentFlavors. Basically, it provides a blanket override for 
ISchema, and composes a schema by looking up named adapters in various ways.

My thoughts (well, after changing my mind) when I worked on this a while 
ago was that AT provides the plumbing to get the schema from somewhere 
else (the ISchema adapter), and ContentFlavors (an optional dependency 
for when you need it) provides the grease to make it easy to pull in 
schemas from various places; something very generic that wants to mess 
with many content objects can use CF to do so in a generic way.

In this case, however, I don't see why we need to bother at all. It's 
just as easily made using an ATCT-specific field/mixin-with-mutator.


More information about the Framework-Team mailing list