[Product-Developers] schemaextender and adapter registration

Hedley Roos hedleyroos at gmail.com
Mon Aug 11 22:10:27 UTC 2008


Hi all

A brief example...

Class Triangle subclasses Shape.

In my zcml I have

<adapter
  factory=".shape.ShapeExtender"
  for="Products.MyProduct.content.shape.Shape"
  name="shape-extender"/>
<adapter
  factory=".triangle.TriangleExtender"
  for="Products.MyProduct.content.triangle.Triangle"
  name="triangle-extender"/>

I find that schemaextender tries to call the extender for Shape even
when I am looking (eg. base_edit'ing) at a Triangle instance. This
causes problems with the getOrder method since Shape is not supposed
to know about Triangle's fields.

In extender.py method instanceSchemaFactory we have extenders =
list(getAdapters((context,), ISchemaModifier)) and that returns both
extenders. Is it supposed to do that? And if so is there a zcml
directive which can solve my problem?

My current horrid workaround is to abuse the resolution order and name
the triangle adapter "atriangle-extender".

Many thanks
Hedley




More information about the Product-Developers mailing list