[Zope3-dev] TTW Schema-based content types

Sidnei da Silva sidnei@plone.org
Mon, 4 Aug 2003 14:13:14 -0300


On Mon, Aug 04, 2003 at 12:01:46PM -0400, Jim Fulton wrote:
| Sidnea threatened to start working on "ttw schema". I'm note sure
| exactly what he means, but I thought I should write down some of my thoughts
| on the matter.

Just for the records what I want is exactly what you stated.

So, putting stuff together:

| Here's what *I* want. I want people to be able to create schemas in
| site-management folders.  There should be a nice GUI UI for
| this. (Note that you can create schemas in persistent modules TTW
| now. Of course, there's no UI.) These schemas should register
| themselves with the schema service.

We currently don't differentiate schemas from interfaces, and we have
a interface service, so it seems that we need a 'local'
(a.k.a. persistent) interface service.

| The schema building UI needs to know about available fields. I can
| see a couple of ways to approach this. There could be a field
| service, or, perhaps, the factory service could be used.  Maybe the
| builder should ask the factory service for factories that create
| IField objects. This will require enehancements to the factory
| service though.

I like the idea of doing this with the factory service. I had the need
of doing something extremely similar to this and ended up not doing it
because I thought it was specific to my app. So, I propose changing
the IFactoryService to have the following:

  def getFactoriesFor(iface):
    """ Return a list of factories that creates object which implement
    the given interface """

Looks good?

| Once we have a schema, it should be easy to create a content type
| based on the schema.  There should be a class with __getattr__,
| __setattr__ and __delattr__ that uses the schema to provide data
| management.  I suggest that these TTW schema should have the
| property that each field should have a unique id.  The content class
| should use the ids, rather than the field names to manage data.
| That way, fields can be renamed without messing up existing
| instances.

Ok, I had some trouble figuring out where this would take me, but I
think I see it now. I think that when we have a TTW Schema registered
with the interface service, the next step for creating a content
object is registering a factory for our TTW Schema. This factory could
also use a 'mixin' class of choice or other fancy stuff one would want
plus the class Jim suggested (with custom __**attr__) and generate a
content object. We can also need to provide an additional list of
interfaces this object will implement.

The third important thing is assigning security permissions to the TTW
Schema. Stephan Richter says that he has code for that in the workflow
package.

The fourth important thing is registering views for our TTW
Schema. AFAICT, the current machinery is already able to do this,
provided that we have the interface in place. (We have a local view
service, dont we?)

Is there something else missing here?

Now to the next level (or back to the black board):

For generating the so called TTW Schema, there is some stuff in place
under the schemagen package, that Steve and Faassen wrote up back in
December. No one seems to be using it, AFAICT, but it looks like we
can get very close to what we want by starting from there. Any objections?

[]'s
-- 
Sidnei da Silva <sidnei@plone.org>
dreamcatching :: making your dreams come true
http://dreamcatcher.homeunix.org

All your files have been destroyed (sorry).  Paul.