Skip to content

Commit

Permalink
Make choice renderer more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
msom committed Jan 30, 2015
1 parent 7a5c426 commit 825ec8e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions seantis/people/browser/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,12 @@ def __call__(self, context, field, options):
value = getattr(context, field)
schema = tools.get_schema_from_portal_type(context.portal_type)
name = schema.get(field).vocabularyName
voca = zope.component.getUtility(IVocabularyFactory, name)(context)
voc = zope.component.getUtility(IVocabularyFactory, name)(context)

return voca.getTerm(value).title
try:
return voc.getTerm(value).title
except LookupError:
return value


# This is not the best way to match objects to classes, but it sure is the
Expand Down

0 comments on commit 825ec8e

Please sign in to comment.