TTW Schema and Zope 3

This week, I and Stephan Richter were working on TTW Schema in Zope
3. I started it because it was needed for a project of mine, which
aims to integrate SQLObject and Zope 3. The use case I had was the

  • A object would need to have a category
  • Depending on the category, different additional fields would be
    needed to be filled by the user
  • The site manager should be able do control what fields are required
    for a given category

It sounds simple to you? Guess what: It took me almost a week to get
it implemented. Here’s what we did:

  • Created a ‘Persistent Schema Utility’ object, which is registered
    as a utility and contains Fields. It also implements IInterface.
  • Modified the local and global interface services to query the
    utility service for utilities providing a given interface when asked
    for a given interface

So at this point, you would be able to use a Persistent Schema Utility
as an interface. Of course it required some fixes on the
InterfaceWidget and a few other places that always assumed an
interface could be named after its __module__ and __name__, which is
not true on our case.

Next step was to do some work on the View service to get it working
with this. Nicely enough, it had only one problem: the ‘attribute’
field was not showing up on the addform view, so we added it. Then I
could test it by assigning the persistent schema to an existing object
and trying to use the registered local view (with a special
EditView-based class and template) to show an edit form for the
persistent schema. Guess what? It worked! I had to make some
adjustments on fields interfaces and register some zcml for fields but
that was mostly it.

Then Stephan Richter jumped in to help me, and built a Content
Component Utility, that lets you choose a schema and builds a content
object from that. It also allows you to set permissions for each field
of the schema, which is amazing!

An finally, to finish it all, Stephan wrote a local version of the
BrowserMenuService, to allow registering menus ttw, much the same way
as we register fields for persistent schema.

All I have to say is that this is looking extremely nice. Far more
nicer than I expected. Next step is finishing up some UI nitpicks and
getting Paul to make one of those amazing movies he does, explaining
how things work.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.