def review_state(self,value): ''' A key to value method ''' states = {'new':_('New'), 'pending':_('Pending'), 'confirmed':_('Confirmed'), 'cancelled':_('Cancelled'),} return states.get(value,value)
def registration_options(self): base = self.context.absolute_url() options = [ {'type':'apyb','href':'%s/@@registration-apyb' % base,'text':_(u'Register as an APyB Member'),}, {'type':'student','href':'%s/@@registration-student' % base,'text':_(u'Register as a student'),}, {'type':'individual','href':'%s/@@registration-individual' % base,'text':_(u'Register as an Individual'),}, {'type':'group','href':'%s/@@registration-group' % base,'text':_(u'Register members of a group or organization (Group registration)'),}, {'type':'government','href':'%s/@@registration-gov' % base,'text':_(u'Register member(s) of Brazilian Government'),}, ] return options
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(), )