def classify_spam(uid): """ Score the spam with a slight delay. """ from biostar.forum import spam from biostar.forum.models import Post post = Post.objects.filter(uid=uid).first() # Give spammers the illusion of success with a slight delay time.sleep(1) # Non spam posts are left alone. if post.not_spam: return try: # Give this post a spam score and quarantine it if necessary. spam.score(uid=uid) # Add this post to the spam index. spam.add_spam(uid=uid) except Exception as exc: message(exc)
def update_spam_index(post): """ Update spam index with this post. """ from biostar.forum import spam # Index posts explicitly marked as SPAM or NOT_SPAM # indexing SPAM increases true positives. # indexing NOT_SPAM decreases false positives. if not (post.is_spam or post.not_spam): return # Update the spam index with most recent spam posts try: spam.add_spam(post=post) except Exception as exc: message(exc)
def update_spam_index(uid): """ Update spam index with this post. """ from biostar.forum import spam, models post = models.Post.objects.filter(uid=uid).first() # Index posts explicitly marked as SPAM or NOT_SPAM # indexing SPAM increases true positives. # indexing NOT_SPAM decreases false positives. if post.spam == models.Post.DEFAULT: return # Update the spam index with most recent spam posts try: spam.add_spam(post=post) except Exception as exc: message(exc)