[Zope3-dev] How to add schema fields programmatically, from an outside schema definition?

Petri Savolainen petri.savolainen at iki.fi
Thu Dec 30 17:07:17 EST 2004


Hello,

Rather than coding schema in python, I've specified one using YAML 
markup (http://www.yaml.org) and stored it in an outside file. Here's a 
simple snippet:

IPerson:
    # A person
    first:
       type: TextLine
       title: First name
       description: The first name, also known as given name, of the person

But what is the right spot within zope3 processing chain to add the 
schema fields into the interface class? It appears it is not ok to 
simply try and add fields to the class from within the same module where 
IPerson is defined is not working, as in:

class IPerson(...):
   ...

setSchema("schemata.yml",IPerson)


Any advice?

Thanks,

  Petri



More information about the Zope3-dev mailing list