Héctor Velarde wrote:
after getting some help from Martin I was able to solve some of the problems I found in my implementation. now I have methods for getting default values and vocabularies and they work like a charm.

but when I tried to change the order of the fields I found IOrderableSchemaExtender only knows about fields defined inside my extender. it wouldn't work for me because I want to move 'relatedItems' and 'subject' around schematas.

Erik Rose showed me the ISchemaModifier adapter that, if I understood correctly, let me do everything by modifying the schema directly.

my question now is, what's the best and/or safer approach to accomplish what I want:

class NITFExtender(object):
     adapts(IATNewsItem)
     implements(ISchemaExtender)
     implements(ISchemaModifier)

The correct way to implement multiple things is:

 implements(IAlpha, IBeta)

class NITFExtender(object):
     adapts(IATNewsItem)
     implements(ISchemaModifier)

However, as you found out, since ISchemaModifier extends ISchemaExtender, you only need one.

in the first case, I can use ISchemaExtender to add the new fields and ISchemaModifier to change schemata and order.

in the second case, I can use ISchemaModifier to add the new fields and change schemata and order.

Yep.

Martin

--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to