Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How the heck do you use this with a portlet? (see answer below) #17

Open
dholth opened this issue Mar 19, 2015 · 1 comment
Open

How the heck do you use this with a portlet? (see answer below) #17

dholth opened this issue Mar 19, 2015 · 1 comment

Comments

@dholth
Copy link

dholth commented Mar 19, 2015

from zope.interface import implements, directlyProvides
from plone.portlets.interfaces import IPortletDataProvider
from zope.schema.interfaces import IContextSourceBinder

SomeVocabulary = NamedVocabulary("some.vocabulary")

def someVocabularyBinder(context):
    vocab = SomeVocabulary(context).items()
    return SimpleVocabulary.fromItems(vocab.items())
directlyProvides(someVocabularyBinder, IContextSourceBinder)

class IPortlet(IPortletDataProvider):
    value = schema.Choice(title=u'Some choice', 
        description=u'A choice', 
        source=someVocabularyBinder)
@tomgross
Copy link
Member

tomgross commented Jul 3, 2015

@dholth What do you exactly want to achieve? Display a vocabulary as list in a portlet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants