I was checking Maurits' code to see how to use default_method and vocabulary but it's not working for me (I'm using schemaextender).

this is what I have:

class NITFExtender(object):
    """Adapter to add NITF fields to News Items
    """
    adapts(IATNewsItem)
    implements(ISchemaExtender)

    fields = [
        SectionField('section',
            #default_method='_getDefaultSection',
            languageIndependent=1,
            enforceVocabulary=1,
            required=1,
            vocabulary='_getUserSections',
            widget = SelectionWidget(
                label='Section',
                description='Named section for the news object')),
        ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self.fields

    def _getDefaultSection(self):
        return 'Sports'

    def _getUserSections(self):
        """returns a list of available sections"""
        return DisplayList(SECTIONS)

this is what I get:

ValueError: property.default_method is neither a method of <class 'Products.ATContentTypes.content.newsitem.ATNewsItem'> nor a callable

what I'm doing wrong?

saludos


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

Reply via email to