Inheritance of form schema hints

Hi Plone Developers!

I currently learned that schema hints are not inherited by chield classes of a schema.

Let's assume a simple case:

class IEmailAddress(model.Schema):

    read_permission(  check_spam='' )
    write_permission( check_spam='' )
    check_spam = schema.Bool(default=True,
                             title=_("check spam"),

class ISpecialEmailAddress(IEmailAddress)

    check_virus = schema.Bool(default=True,
                             title=_("check virus"),

The permissions set on the field "check_spam" are working perfectly on forms utilizing IEmailAddress but not on forms utilizing ISpecialEmailAddress.

Let us further assume that this behavior is intended - since it exhibits an inbuild logic: If the form hints were to be inherited - how to get rid of them in client classes?

We have an application with quite a bit of inheritence of schemas. So it would be nice to know a way to inherit the schema hints to a child schema, explizitly. Is there an API for it? If not please do not elaborate! I can fiddle that pice of code myself, but I prefere to use code already existing.

Any help appreciated


Welcome to inheritance!

Build guess: can you split up schema definition and specific form constraints as in your case into a pure schema class and a constraints class? You could use the constraints class as mixin for the particular form where you need it and just use the inherited schema class without the constraints class inside your derived class?


I think this as a kind of bug/missing feature. May you file an issue in the plone.dexterity issue tracker please?


That is not possible since the form hints require a direct reference to the fields in the same schema class.

class IEnabledByAdminHints(model.Schema):


class IEnabledByAdmin(model.Schema, IEnabledByAdminHints):

    Schema for enabled by admin
    enabled_by_admin = schema.Bool(
        title=_(u"Enabled By Admin"),

zope.configuration.config.ConfigurationExecutionError: <type 'exceptions.ValueError'>: The directive applied to interface refers to unknown field name enabled_by_admin

Or did I get your idea wrong?