def vocabulary_mailattributes(context): terms = list() for field in grok.AutoFields(interfaces.IMail): if IList.providedBy(field.field): name = '%s %s' % (field.field.title, _('(List)'),) else: name = field.field.title terms.append(vocabulary.SimpleTerm(value=field.field.getName(), title=name)) return vocabulary.SimpleVocabulary(terms)
def vocabulary_propose(context): index = 0 terms = list() for field in grok.AutoFields(interfaces.IMail): if IList.providedBy(field.field): continue name = '(Mail) %s' % field.field.title index += 1 value = 'placeholder_field_%s' % index terms.append(vocabulary.SimpleTerm(value=value, token=field.field.getName(), title=name)) terms.append(vocabulary.SimpleTerm(value=datetime.now().strftime('%Y-%m-%d%T%H:%M:%S'), token='datetime_now', title=translate(_('Date Time'), context=utils.getRequest()))) terms.append(vocabulary.SimpleTerm(value=datetime.now().strftime('%Y-%m-%d'), token='date_now', title=translate(_('Date'), context=utils.getRequest()))) terms.append(vocabulary.SimpleTerm(value=datetime.now().strftime('%H:%M:%S'), token='time_now', title=translate(_('Time'), context=utils.getRequest()))) return vocabulary.SimpleVocabulary(terms)
def item_title(self): return _('Mail ${id}', mapping=dict(id=self.context.id))