Example #1
0
 def validate_email(self, email):
     Validator.required(email)
     Validator.length(email, 5, 40)
     user = User.query.filter_by(email=email.data).first()
     if user:
         raise ValidationError(
             f"{email.data} : Cet email est déja pris, veuillez en choisir un autre."
         )
Example #2
0
 def validate_username(self, username):
     Validator.required(username)
     Validator.length(username, 6, 40)
     user = User.query.filter_by(username=username.data).first()
     if user:
         raise ValidationError(
             f"{username.data} : Ce nom d'utilisateur est déja pris, veuillez en choisir un autre."
         )
Example #3
0
 def validate_not_key_words(self, not_key_words):
     if not_key_words.data:
         Validator.length(not_key_words, 0, 300)
         _not_key_words = not_key_words.data.split(",")
         _not_key_words = [
             i.lower().strip().replace("  ", " ").replace("-", " ").replace(
                 "  ", " ").strip() for i in _not_key_words
         ]
         _not_key_words = ", ".join(_not_key_words)
         self.not_key_words.data = not_key_words.data = _not_key_words
Example #4
0
 def validate_key_words(self, key_words):
     Validator.required(key_words)
     Validator.length(key_words, 6, 300)
     _key_words = key_words.data.split(",")
     if not len(_key_words) >= 3:
         raise ValidationError('minimum 3 mots')
     _key_words = [
         i.lower().strip().replace("  ",
                                   " ").replace("-",
                                                " ").replace("  ",
                                                             " ").strip()
         for i in _key_words
     ]
     _key_words = ", ".join(_key_words)
     self.key_words.data = key_words.data = _key_words
Example #5
0
 def validate_diploma_year(self, diploma_year):
     Validator.required(diploma_year)
     Validator.length(diploma_year, 4, 4)
     Validator.numerical(diploma_year)
     if not (2020 >= int(str(diploma_year.data).strip()) >= 1969):
         raise ValidationError(
             'Humm... Vous êtes trop jeune ou trop agé pour travailler, non?'
         )
Example #6
0
 def validate_resume_name(self, resume_name):
     Validator.required(resume_name)
     Validator.length(resume_name, 3, 40)
Example #7
0
 def _validate_diploma_town(diploma_town):
     Validator.required(diploma_town)
     Validator.length(diploma_town, 2, 50)
Example #8
0
 def validate_xp_at_work(self, xp_at_work):
     Validator.required(xp_at_work)
     Validator.length(xp_at_work, 1, 2)
     Validator.xp(xp_at_work)
Example #9
0
 def validate_email(self, email):
     Validator.required(email)
     Validator.length(email, 5, 40)
Example #10
0
 def validate_job(self, job):
     Validator.required(job)
     Validator.length(job, 3, 50)
Example #11
0
 def validate_key_words(self, key_words):
     Validator.required(key_words)
     Validator.length(key_words, 6, 300)
     _key_words = key_words.data.split(",")
     if not len(_key_words) >= 3:
         raise ValidationError('3 or more words')
Example #12
0
 def validate_birth_town(self, birth_town):
     Validator.required(birth_town)
     Validator.length(birth_town, 2, 50)
Example #13
0
 def validate_town(self, town):
     Validator.required(town)
     Validator.length(town, 2, 50)
Example #14
0
 def validate_nationality(self, nationality):
     Validator.required(nationality)
     if nationality.data not in Country.list_all():
         raise ValidationError('Ce pays est inconnu')
Example #15
0
 def validate_birth_zip_code(self, birth_zip_code):
     Validator.required(birth_zip_code)
     Validator.length(birth_zip_code, 5, 5)
     Validator.numerical(birth_zip_code)
Example #16
0
 def validate_birthdate(self, birthdate):
     Validator.required(birthdate)
     Validator.length(birthdate, 8, 12)
     Validator.date(birthdate)
Example #17
0
 def validate_lastname(self, lastname):
     Validator.required(lastname)
     Validator.length(lastname, 2, 40)
Example #18
0
 def validate_firstname(self, firstname):
     Validator.required(firstname)
     Validator.length(firstname, 2, 40)
Example #19
0
 def validate_company(self, company):
     Validator.required(company)
     Validator.length(company, 2, 50)
Example #20
0
 def validate_zip_code(self, zip_code):
     Validator.required(zip_code)
     Validator.length(zip_code, 5, 5)
     Validator.numerical(zip_code)
Example #21
0
 def validate_xp_at_company(self, xp_at_company):
     Validator.required(xp_at_company)
     Validator.length(xp_at_company, 1, 2)
     Validator.xp(xp_at_company)
Example #22
0
 def validate_country(self, country):
     Validator.required(country)
     if country.data not in Country.list_all():
         raise ValidationError('Ce pays est inconnu')
Example #23
0
 def validate_xp_at_job(self, xp_at_job):
     Validator.required(xp_at_job)
     Validator.length(xp_at_job, 1, 2)
     Validator.xp(xp_at_job)
Example #24
0
 def validate_country_5(self, country_5):
     if (self.mob.data == "Pays") and country_5.data:
         Validator.country(country_5)
Example #25
0
 def validate_country_1(self, country_1):
     if self.mob.data == "Pays":
         Validator.required(country_1)
         Validator.country(country_1)
Example #26
0
 def validate_diploma_name(self, diploma_name):
     Validator.required(diploma_name)
     Validator.length(diploma_name, 2, 50)
Example #27
0
 def validate_confirm_password(self, confirm_password):
     Validator.required(confirm_password)
     Validator.length(confirm_password, 8, 40)
     if not self.password.data == confirm_password.data:
         raise ValidationError(f"Les mots de passe ne sont pas identiques.")
Example #28
0
 def validate_diploma_school(self, diploma_school):
     Validator.required(diploma_school)
     Validator.length(diploma_school, 2, 50)
Example #29
0
 def validate_password(self, password):
     Validator.required(password)
     Validator.length(password, 8, 40)
     Validator.password_hard(password)
Example #30
0
 def validate_region_1(self, region_1):
     if self.mob.data == "Région":
         Validator.required(region_1)
         Validator.region(region_1)