예제 #1
0
파일: forms.py 프로젝트: sfu-fas/coursys
 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
예제 #2
0
 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
예제 #3
0
파일: forms.py 프로젝트: sfu-fas/coursys
 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
예제 #4
0
 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