def clean_formula(self): formula = self.cleaned_data['formula'] if formula: if self._addform_validate or self._editform_validate: try: parse_and_validate_formula(formula, self.course, self.activity, self._course_numeric_activities) except ValidationError as e: raise forms.ValidationError(e.args[0]) return formula
def clean_formula(self): formula = self.cleaned_data['formula'] if formula: if self._addform_validate or self._editform_validate: try: parse_and_validate_formula(formula, self.course, self.activity, self._course_numeric_activities) except ValidationError as e: raise forms.ValidationError(e.args[0]) return formula
def clean_formula(self): formula = self.cleaned_data['formula'] if formula: if self._form_entry_validate: try: parsed_expr = parse_and_validate_formula(formula, self.course, self.activity, self._course_numeric_activities) except ValidationError as e: raise forms.ValidationError(e.args[0]) else: self.pickled_formula = pickle.dumps(parsed_expr) return formula
def clean_formula(self): formula = self.cleaned_data['formula'] if formula: if self._form_entry_validate: try: parsed_expr = parse_and_validate_formula( formula, self.course, self.activity, self._course_numeric_activities) except ValidationError as e: raise forms.ValidationError(e.args[0]) else: self.pickled_formula = pickle.dumps(parsed_expr) return formula