Exemplo n.º 1
0
 def _to_python(self, value, state):
     from adhocracy.model import InstanceBadge
     try:
         value = int(value)
     except:
         pass
     badge = InstanceBadge.by_id(value, instance_filter=False)
     if badge is None or badge.instance not in [None, c.instance]:
         raise formencode.Invalid(
             _("No Badge ID '%s' exists") % value, value, state)
     return badge
Exemplo n.º 2
0
 def _to_python(self, value, state):
     from adhocracy.model import InstanceBadge
     try:
         value = int(value)
     except:
         pass
     badge = InstanceBadge.by_id(value, instance_filter=False)
     if badge is None or badge.instance not in [None, c.instance]:
         raise formencode.Invalid(
             _("No Badge ID '%s' exists") % value,
             value, state)
     return badge