Method for getting a field definition from the form definition. Replaces previous private method.

pull/7/head
Ferry Boender 10 years ago
parent 34b4151529
commit b53f5fcf40
  1. 4
      src/scriptform.py

@ -388,7 +388,7 @@ class FormDefinition:
self.submit_title = submit_title self.submit_title = submit_title
self.allowed_users = allowed_users self.allowed_users = allowed_users
def _get_field(self, field_name): def get_field_def(self, field_name):
for field in self.fields: for field in self.fields:
if field['name'] == field_name: if field['name'] == field_name:
return field return field
@ -429,7 +429,7 @@ class FormDefinition:
this class in the form 'validate_<field_type>'. this class in the form 'validate_<field_type>'.
""" """
# Find field definition by iterating through all the fields. # Find field definition by iterating through all the fields.
field_def = self._get_field(field_name) field_def = self.get_field_def(field_name)
if not field_def: if not field_def:
raise ValidationError("Unknown field: {0}".format(field_name)) raise ValidationError("Unknown field: {0}".format(field_name))

Loading…
Cancel
Save