[Grok-dev] Dynamic Schemas: Best practices?

Uli Fouquet uli at gnufix.de
Wed Dec 12 10:53:51 EST 2007


Hi there,

while writing an article about grok for a German computer magazine, I
stumbled about a (IMHO) very common usecase:

In applications one sometimes wants to offer 'dynamic schemas', i.e.
data schemas based on end-users' choices. As you know there is excellent
support in grok/Zope3 for _fixed_ schemas based on the schema and
formlib package. You can simply define an interface with schemas, tell
your 'content-classes' to implement it and applied views will render
that schema into forms. That's plain and easy, at least with grok :-)

However, if you want to enable your users to add, modify or delete
fields from a given set of fields, it becomes more complex (and
error-prone). You have to set up the fields of every form 'manually' and
you can't rely on interfaces anymore, because they have a fixed set of
schema fields. Further problems like data consistency of already created
objects arise in the background.

Therefore my (maybe dumb) question: is there a best practice or
recommended way to set up such data containers, that provide a certain
set of allowed field-types which lateron can be modified by users? Or is
this a configuration issue, which should be handled outside the source
code?

Kind regards,

-- 
Uli




More information about the Grok-dev mailing list