I'm running Plone 5.0.2 and making an addon which will have a custom DX which needs AjaxSelectFieldWidget. I tried using AutocompleteMultiFieldWidget but that is a whole other can of problems. I need a bunch of custom fields which will act like the plone Tags field. I've been at this all day now.
The schema definition looks like
multi_field_test = schema.Tuple( title=u'My Multi Field Test', description=u'Desc', required=False, value_type=schema.TextLine(), missing_value=(), ) #directives.read_permission(multi_field_test='cmf.AddPortalContent') #directives.write_permission(multi_field_test='cmf.AddPortalContent') directives.widget( 'multi_field_test', AjaxSelectFieldWidget, vocabulary='plone.app.vocabularies.Keywords' )
However it is throwing:
Traceback (innermost last): Module ZPublisher.Publish, line 138, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 48, in call_object Module plone.app.content.browser.vocabulary, line 76, in __call__ Module plone.app.content.browser.vocabulary, line 207, in get_vocabulary Module plone.app.dexterity.permissions, line 60, in validate AttributeError: 'DXAddViewFieldPermissionChecker' object has no attribute '_request'
- Where I'm going wrong?
- Can someone provide a good concrete example of this on github?
- Where does the Tags DX behavior and schema live in the plone namespace so I can reverse engineer this? (I've looked in plone.app.contenttypes and plone.behaviours)
I've tried static SimpleVocabulary and it results in the same odd error. I'm wondering if the directive.widget is correct? I've seen some other people use form.widget but they didn't provide the import.