Schema by Interface / Content Flavors

sirgarr georgeleejr at gmail.com
Thu Aug 30 20:14:31 UTC 2007



Martin Aspeli wrote:
> 
> schema-by-interface (or rather, schema-by-adapter-lookup) is supported 
> in AT 1.5.
> 

Ah, yes -- I see this in
http://dev.plone.org/archetypes/browser/Archetypes/trunk/Schema/factory.py

And with Plone 3.0 / Zope 2.10, it's possible to register an adapter locally
(e.g., with GenericSetup in componentregistry.xml), so that MyContentType
can behave one way in one Plone Site, and have an extended schema in another
Plone site -- is that correct?

But how would I deal with this (from factory.py's doctext):


 The challenge is that the accessors and mutators of the returned schema
must be available as methods on 'context', with appropriate security
declarations. When the schema is set in a 'schema' class-attribute, this is
taken care of by ClassGen. However, if you wish to provide the schema with a
different adapter, you have three choices:
> 
> 1. Provide the accessor and mutator methods explicitly in the class. ...
> 
> 3. Add the methods per-instance yourself.  This is what the ContentFlavors
> product does, so you may be better off using that.
> 

Is it okay practice to add the methods explicitly in the class or
monkey-patch it, knowing that they will not be used in some sites (where I
don't register a new schema adapter) but that they will be used in others?

Peace,
George
-- 
View this message in context: http://www.nabble.com/Schema-by-Interface---Content-Flavors-tf4355401s20094.html#a12415129
Sent from the Product Developers mailing list archive at Nabble.com.





More information about the Product-Developers mailing list