cubicweb/web/views/forms.py
changeset 12567 26744ad37953
parent 11910 af969080e7e6
equal deleted inserted replaced
12566:6b3523f81f42 12567:26744ad37953
    42 but you'll use this one rarely.
    42 but you'll use this one rarely.
    43 """
    43 """
    44 
    44 
    45 import time
    45 import time
    46 import inspect
    46 import inspect
    47 
       
    48 from six import text_type
       
    49 
    47 
    50 from logilab.common import dictattr, tempattr
    48 from logilab.common import dictattr, tempattr
    51 from logilab.common.decorators import iclassmethod, cached
    49 from logilab.common.decorators import iclassmethod, cached
    52 from logilab.common.textutils import splitstrip
    50 from logilab.common.textutils import splitstrip
    53 
    51 
   284                     for field, value in field.process_posted(self):
   282                     for field, value in field.process_posted(self):
   285                         processed[field.role_name()] = value
   283                         processed[field.role_name()] = value
   286                 except ProcessFormError as exc:
   284                 except ProcessFormError as exc:
   287                     errors.append((field, exc))
   285                     errors.append((field, exc))
   288             if errors:
   286             if errors:
   289                 errors = dict((f.role_name(), text_type(ex)) for f, ex in errors)
   287                 errors = dict((f.role_name(), str(ex)) for f, ex in errors)
   290                 raise ValidationError(None, errors)
   288                 raise ValidationError(None, errors)
   291             return processed
   289             return processed
   292 
   290 
   293 
   291 
   294 class EntityFieldsForm(FieldsForm):
   292 class EntityFieldsForm(FieldsForm):