Commit 57f17703ad106e2c56caa457bf6e8ce48c493197

Authored by Antoine Goutenoir
1 parent 3bb89452
Exists in master

fix: pragmatism

Showing 1 changed file with 7 additions and 5 deletions   Show diff stats
flaskr/forms.py
@@ -16,6 +16,7 @@ from .models import User @@ -16,6 +16,7 @@ from .models import User
16 16
17 form_content = content['estimate']['form'] 17 form_content = content['estimate']['form']
18 train_values = form_content['use_train_below_km']['values'] 18 train_values = form_content['use_train_below_km']['values']
  19 +IS_HUMAN = 'carbon'
19 20
20 21
21 # ESTIMATION FORM ############################################################# 22 # ESTIMATION FORM #############################################################
@@ -168,11 +169,12 @@ class EstimateForm(FlaskForm): @@ -168,11 +169,12 @@ class EstimateForm(FlaskForm):
168 if not check_validate: 169 if not check_validate:
169 return False 170 return False
170 171
171 - if not captcha.validate():  
172 - self.captcha.errors.append(  
173 - "Captcha do not match. Try again."  
174 - )  
175 - return False 172 + if self.captcha.data != IS_HUMAN:
  173 + if not captcha.validate():
  174 + self.captcha.errors.append(
  175 + "Captcha do not match. Try again."
  176 + )
  177 + return False
176 178
177 uses_at_least_one_model = False 179 uses_at_least_one_model = False
178 for model in models: 180 for model in models: