Replace profanity-filter with better-profanity

Since Heroku refuses to let me downloda the spaCy model, we're going
with this instead. :/
This commit is contained in:
Xevion
2022-03-30 15:57:47 -05:00
parent 3a0c1690d3
commit 73d9fd5454
3 changed files with 21 additions and 16 deletions

View File

@@ -1,8 +1,6 @@
from typing import Optional
from profanity_filter import ProfanityFilter
from wtforms.validators import ValidationError
pf = ProfanityFilter()
from better_profanity import profanity
class NoProfanity(object):
@@ -12,5 +10,5 @@ class NoProfanity(object):
self.message = message
def __call__(self, form, field):
if pf.is_profane(field.data):
if profanity.contains_profanity(field.data):
raise ValidationError(self.message)