Hi Adam  

> Betreff: [Zope-dev] proposal: Custom schema properties
> Hello,
> Custom schema properties proposal
> =================================
> The problem
> ------------
> is that we have a "baseline" project. This baseline project 
> gets customized for each client. Each client has different 
> (usually just a little bit) needs in terms of field titles 
> and field required.
> The real problem is, to achieve this we have to create a new 
> interface with the overridden field. This starts the domino 
> effect, we have to create a new class, this new class needs 
> to be instantiated, new add form, new edit form and register 
> those. A hell lot of code to support that tiny change. 
> The solution
> ------------
> would be to have default schema properties defined as "usual"
> (depending on the implementation the field object would come 
> from a different package). Those defaults can be overridden 
> by "Interface.fieldName" and site (by utility or adapter 
> lookup). Seems like fields that are not overridden in the 
> interface subclasses might not be overridden. 
> Further goal could be to have these customizations easily 
> modified TTW. That somehow suggest that an adapter 
> registration for each property customization is a no-go. 
> Performance
> Performance needs to be as close as possible to the plain 
> schema implementation. I guess field properties get evaluated 
> quite often per request, an adapter/utility lookup per 
> property evaluation is a no-go. 
> I'd say zope.schema classes should stay as they are, the 
> custom schema will be done using subclasses. 
> Dependencies
> If no additional dependencies will be added to zope.schema 
> the implementation could go into zope.schema.custom if yes 
> z3c.schema.custom could be the place. 
> Opinions? Anyone suffering the same problems?

If we implement a generic solution which allows to manipulate
all field properties, we should probably add an option for mark
customizable fields for define some minimal requirements e.g.
min=2 can get overriden with min=1 but not with min=0 etc.

We should also make sure that we can change a field
default='foo' to default='bar' but not required=True 
to required=False etc.

This probably means that we should have one or more customization
properties for each existing field property.

Based on the complexity of this implementation we should implement
this concept as a z3c package. This package will probably also 
depend on other z3c.schema fields e.g. z3c.schema.email if we
need to implement special customization properties for each field.

Roger Ineichen

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to