Schema by Interface / Content Flavors
optilude at gmx.net
Thu Aug 30 20:44:54 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
> 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?
Monkey patching is inherently global, so you can't have different
methods in different Plone sites.
You probably want the 3.0 branch of ConcentFlavors, though I'm not sure
if it's 100% complete or working (I haven't had time to look at it for a
Acquisition is a jealous mistress
More information about the Product-Developers