# -*- coding: utf-8 -*- from Products.CMFCore.utils import getToolByName from zope.schema.vocabulary import SimpleVocabulary from zope.schema.vocabulary import SimpleTerm from sc.base.grokutils import registerSimpleVocabulary from apyb.papers import MessageFactory as _ registerSimpleVocabulary( "ReferenceType", u"apyb.papers.talk", [("article", _(u"Article / Post")), ("presentation", _(u"Presentation")), ("video", _(u"Video"))], globals(), ) registerSimpleVocabulary("Type", u"apyb.papers.talk", [("talk", _(u"Talk")), ("panel", _(u"Panel"))], globals()) def trackVocabulary(context): """Vocabulary factory for talk track options """ ct = getToolByName(context, "portal_catalog") tracks = ct.searchResults(portal_type="apyb.papers.track", sort_on="getObjPositionInParent") items = [SimpleTerm(b.UID, b.UID, b.Title) for b in tracks] return SimpleVocabulary(items) registerSimpleVocabulary("Track", u"apyb.papers.talk", trackVocabulary, globals()) registerSimpleVocabulary( "Level",
from zope.schema.vocabulary import SimpleVocabulary from zope.schema.vocabulary import SimpleTerm from Products.CMFCore.utils import getToolByName from apyb.registration import MessageFactory as _ # registerSimpleVocabulary calls require the module global dictionary # as the last parameter in order for grok to register its variables # in this module (normally it would be done silently # and implicitly by a call to grok.global_utils registerSimpleVocabulary( "Gender", u"apyb.registration", [('m', _(u'Male')), ('f', _(u'Female')), ], globals(), ) registerSimpleVocabulary( "TShirt", u"apyb.registration", [ ('S', _(u'Small')), ('M', _(u'Medium')), ('L', _(u'Large')), ('X', _(u'X-Large')), ], globals(), )