def validate_job_headline(form, field): # XXX: These validations belong in a config file or in the db, not here. if simplify_text(field.data) == 'awesome coder wanted at awesome company': raise ValidationError(u"Come on, write your own headline. You aren’t just another run-of-the-mill company, right?") for word_list, message in app.config.get('BANNED_WORDS', []): for word in word_list: if word in field.data.lower(): raise ValidationError(message)
def validate_job_headline(form, field): # XXX: These validations belong in a config file or in the db, not here. if simplify_text( field.data) == 'awesome coder wanted at awesome company': raise ValidationError( u"Come on, write your own headline. You aren’t just another run-of-the-mill company, right?" ) for word_list, message in app.config.get('BANNED_WORDS', []): for word in word_list: if word in field.data.lower(): raise ValidationError(message)
def validate_job_headline(form, field): # XXX: These validations belong in a config file or in the db, not here. if simplify_text(field.data) == 'awesome coder wanted at awesome company': raise ValidationError(u"Come on, write your own headline. You aren’t just another run-of-the-mill company, right?") caps = len(CAPS_RE.findall(field.data)) small = len(SMALL_RE.findall(field.data)) if small == 0 or caps / float(small) > 0.5: raise ValidationError("No shouting, please. Reduce the number of capital letters in your headline") for word_list, message in app.config.get('BANNED_WORDS', []): for word in word_list: if word in field.data.lower(): raise ValidationError(message)
def validate_job_headline(form, field): # XXX: These validations belong in a config file or in the db, not here. if simplify_text(field.data) == 'awesome coder wanted at awesome company': raise ValidationError(u"Come on, write your own headline. You aren’t just another run-of-the-mill company, right?") if 'awesome' in field.data.lower(): raise ValidationError(u'We’ve had a bit too much awesome around here lately. Got another adjective?') if 'rockstar' in field.data.lower() or 'rock star' in field.data.lower() or 'rock-star' in field.data.lower(): raise ValidationError(u'You are not rich enough to hire a rockstar. Got another adjective?') if 'kickass' in field.data.lower() or 'kick ass' in field.data.lower() or 'kick-ass' in field.data.lower(): raise ValidationError(u'We don’t condone kicking asses around here. Got another adjective?') if 'ninja' in field.data.lower(): raise ValidationError(u'Ninjas kill people. We can’t allow that. Got another adjective?') if 'urgent' in field.data.lower(): raise ValidationError(u'Sorry, we can’t help with urgent requirements. Geeks don’t grow on trees')