예제 #1
0
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)
예제 #2
0
def spam_scoring(post):
    """
    Score the spam with a slight delay.
    """
    from biostar.forum import spam

    # Give spammers the illusion of success with a slight delay
    time.sleep(1)

    try:
        # Give this post a spam score and quarantine it if necessary.
        spam.score(post=post)
    except Exception as exc:
        message(exc)