test title and description of new poll for spam
This commit is contained in:
parent
26c12c9024
commit
c0d3ec4341
1 changed files with 5 additions and 2 deletions
|
@ -584,11 +584,11 @@ def is_spam_submitter_name(name, errors_dict):
|
|||
return False
|
||||
|
||||
|
||||
|
||||
def count_urls(text):
|
||||
hits = re.findall(r"(\swww\.|http://|https://)", text)
|
||||
return len(hits)
|
||||
|
||||
|
||||
def check_spam_content(text):
|
||||
if re.search(r"(<a\s|\shref=|</a>)", text.lower()):
|
||||
return True
|
||||
|
@ -599,6 +599,7 @@ def check_spam_content(text):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
@bobo.query('/profile/logout')
|
||||
def user_logout(bobo_request):
|
||||
# default start page
|
||||
|
@ -750,7 +751,9 @@ def new_poll(bobo_request, submit=None, cancel=None, author=None, title=None,
|
|||
except formencode.Invalid, errors_packed:
|
||||
errors = errors_packed.unpack_errors()
|
||||
if check_spam_content(title):
|
||||
return bobo.redirect(BASE_DICT["base_url"])
|
||||
errors["title"] = u"Dieser Titel wirkt spam-verdächtig."
|
||||
if description and check_spam_content(description):
|
||||
errors["description"] = u"Der Beschreibungstext wirkt spam-verdächtig."
|
||||
if errors:
|
||||
if not hide_errors:
|
||||
value_dict["errors"] = errors
|
||||
|
|
Loading…
Add table
Reference in a new issue