def _validate_image(values, mandatory_status=True):
 if mandatory_status:
  status = values.get('status')
  if (not status):
   msg = 'Image status is required.'
   raise exception.Invalid(msg)
  if (status not in STATUSES):
   msg = ("Invalid image status '%s' for image." % status)
   raise exception.Invalid(msg)
 _validate_db_int(min_disk=values.get('min_disk'), min_ram=values.get('min_ram'))
 return values

def _validate_image ( values , mandatory_status = True ) : if mandatory_status : status = values . get ( 'status' ) if ( not status ) : msg = 'Image status is required.' raise exception . Invalid ( msg ) if ( status not in STATUSES ) : msg = ( "Invalid image status '%s' for image." % status ) raise exception . Invalid ( msg ) _validate_db_int ( min_disk = values . get ( 'min_disk' ) , min_ram = values . get ( 'min_ram' ) ) return values
validates the incoming data and raises a invalid exception if anything is out of order .