def validate_feature_search_input(self, parameters): # Check that the input contains only allowed fields for field, keyword in parameters.items(): if field not in self.feature_search_valid_fields: raise InvalidFieldException(", ".join([self.get_datatype_identifier(), field, keyword])) # At least one field has to have a non-empty keyword found_field = False for field, keyword in parameters.items(): if len(keyword) > 0: found_field = True continue if not found_field: raise EmptyQueryException(self.get_datatype_identifier())
def validate_field_search_input(self, keyword, field): if field not in self.field_search_valid_fields: raise InvalidFieldException("MIRN", keyword, field)