[Zope-dev] Fun with vocabularies

Charlie Clark charlie.clark at clark-consulting.eu
Tue Oct 12 11:35:49 EDT 2010


Am 07.10.2010, 14:50 Uhr, schrieb Charlie Clark  
<charlie.clark at clark-consulting.eu>:

> Thanks for the tip. For a vocabulary it has to provide IBaseVocabulary as
> well, although I guess I can just define a source. Unfortunately I'm
> getting now getting an AssertionError when the widgets are setup but I  
> now
> know where to look.

Just for the archives

def my_source(context):
	...
	return SimpleVocabulary()
directlyProvides(my_source, IContextSourceBinder)

works fine with

class IMySchema(Interface):

	choices=Choice(
		source=my_source
			)

NB. that you must use "source" and not "vocabulary" for this to work.

Charlie
-- 
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226


More information about the Zope-Dev mailing list