[Product-Developers] Re: extending News Items with schemaextender in Plone 2.5
Martin Aspeli
optilude at gmx.net
Tue Dec 18 09:03:56 UTC 2007
Héctor Velarde wrote:
> I'm starting a new project to extend Plone news items and include a
> bunch of new fields in order to support something called NITF (News
> Industry Text Format) using schemaextender.
>
> I installed schemaextender on "lib/python" using "setup.py install"
>
> I have this on extender.py:
>
> from archetypes.schemaextender.interfaces import ISchemaExtender
> from archetypes.schemaextender.field import ExtensionField
>
> from Products.Archetypes.public import BooleanField, BooleanWidget
> from Products.ATContentTypes.interface import IATNewsItem
>
> from zope.component import adapts
> from zope.interface import implements
>
> class UrgencyField(ExtensionField, BooleanField):
> """Urgency field
> """
>
> class NITFExtender(object):
> """Adapter to add NITF fields to News Items
> """
> adapts(IATNewsItem)
> implements(ISchemaExtender)
>
> fields = [
> UrgencyField('urgency',
> widget = BooleanWidget(
> label='Is this item urgent?')),
> ]
>
> def __init__(self, context):
> self.context = context
>
> def getFields(self):
> return self.fields
>
> and I have this on configure.zcml:
>
> <include package="archetypes.schemaextender" />
> <adapter factory=".extender.NITFExtender" />
>
> when I add a new item I don't see my new field
>
> I'm using the zope3 interface for IATNewsItem.
>
> I'm using schemaextender from trunk.
>
> my product's code is here:
> http://dev.plone.org/collective/browser/nitf4plone/trunk
>
> (I used code from WebLion's guys to install it.)
>
> any hint?
I don't think archetypes.schemaextender will work with anything prior to
Plone 3 (or more specifically, Archetypes 1.5).
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
More information about the Product-Developers
mailing list