def property_clean(prop, value):
  """Apply Property level validation to value.

  Calls .make_value_from_form() and .validate() on the property and catches
  exceptions generated by either.  The exceptions are converted to
  forms.ValidationError exceptions.

  Args:
    prop: The property to validate against.
    value: The value to validate.

  Raises:
    forms.ValidationError if the value cannot be validated.
  """
  if value is not None:
    try:
      prop.validate(prop.make_value_from_form(value))
    except (db.BadValueError, __HOLE__), e:
      raise forms.ValidationError(unicode(e))
dataset/ETHPy150Open IanLewis/kay/kay/utils/forms/modelform.py/property_clean