|
Ciao, sto scrivendo un prodotto, basato su Archetypes, e vorrei usare la MasterSelectWidget con Plone 4.2.4 Premesso che la demo della widget funziona posto il codice: slave_fields2 = ( #Controls the vocabulary of subcategory {'name': 'subcategory', 'action': 'vocabulary', 'vocab_method':'subcategoryVocab', 'control_param':'master', }, ) ATTicketSchema = folder.ATFolderSchema.copy() + atapi.Schema(( ..... atapi.StringField('category', searchable=0, required=0, vocabulary='categoryVocab', widget=MasterSelectWidget( slave_fields=slave_fields2, description="Master", ), ), atapi.StringField('subcategory', searchable=0, required=0, default='', vocabulary='subcategoryVocab', widget=atapi.SelectionWidget( format='select', label=_(u'subcategory_label', default=u'Sub Category'), description=_(u'subcategory_help', default=u"Select helpdesk request sub type"), ), ), ....... security.declarePublic('categoryVocab') def categoryVocab(self): """ """ categories = DisplayList() categories.add('', _(u'-- not specified --')) for category in self.aq_parent.getCategory_list(): categories.add(category, category) return categories security.declarePublic('subcategoryVocab') def subcategoryVocab(self, master): subcategories = DisplayList() subcategories.add('', _(u'-- not specified --')) for subcategory in self.aq_parent.getSubcategory_list(): #if subcategory[0] == master[0]: subcategories.add(subcategory, subcategory) return subcategories ma sembra non trovare il valore di master Error Module zope.pagetemplate.pagetemplate, line 113, in pt_render Warning: Macro expansion failed Warning: <type 'exceptions.KeyError'>: 'macro' ...... URL: file:/usr/local/Plone/buildout-cache/eggs/Products.Archetypes-1.8.6-py2.7.egg/Products/Archetypes/skins/archetypes/widgets/selection.pt Line 36, Column 12 _expression_: <PythonExpr field.Vocabulary(context)> Names: ....... Module Products.Archetypes.utils, line 125, in mapply TypeError: subcategoryVocab() takes exactly 2 arguments (1 given) Qualche idea? --
![]() |
_______________________________________________ Plone-IT mailing list [email protected] https://lists.plone.org/mailman/listinfo/plone-plone-it http://plone-regional-forums.221720.n2.nabble.com/Plone-Italy-f221721.html

