Esempio n. 1
0
def filter_spam(sender, request, form, **kwargs):
    u"""
    Handle spam filtering.

    This function is called when the ``before_send`` signal fires, passing the
    current request and form object to the function. With that information in
    hand, all available spam filters are called.

    TODO: more spam filters
    """
    from envelope.spam_filters import check_honeypot
    return check_honeypot(request, form)
Esempio n. 2
0
def filter_spam(sender, request, form, **kwargs):
    """
    Handle spam filtering.

    This function is called when the ``before_send`` signal fires,
    passing the current request and form object to the function.
    With that information in hand, all available spam filters are called.

    TODO: more spam filters
    """
    if issubclass(sender, ContactView):
        from envelope.spam_filters import check_honeypot
        return check_honeypot(request, form)
Esempio n. 3
0
 def test_filled_honeypot(self):
     u"""
     A value in the honeypot field is an indicator of a bot request.
     """
     self.request.POST[self.honeypot] = u'Hi, this is a bot'
     self.assertFalse(check_honeypot(self.request, self.form))
Esempio n. 4
0
 def test_empty_honeypot(self):
     u"""
     Empty honeypot field is a valid situation.
     """
     self.request.POST[self.honeypot] = u''
     self.assertTrue(check_honeypot(self.request, self.form))
Esempio n. 5
0
def filter_spam(sender, request, form, **kwargs):
    u"""
    Handle spam filtering.
    """
    from envelope.spam_filters import check_honeypot
    return check_honeypot(request, form)
Esempio n. 6
0
 def test_filled_honeypot(self):
     u"""
     A value in the honeypot field is an indicator of a bot request.
     """
     self.request.POST[self.honeypot] = u'Hi, this is a bot'
     self.assertFalse(check_honeypot(self.request, self.form))
Esempio n. 7
0
 def test_empty_honeypot(self):
     u"""
     Empty honeypot field is a valid situation.
     """
     self.request.POST[self.honeypot] = u''
     self.assertTrue(check_honeypot(self.request, self.form))
Esempio n. 8
0
def filter_spam(sender, request, form, **kwargs):
    u"""
    Handle spam filtering.
    """
    from envelope.spam_filters import check_honeypot
    return check_honeypot(request, form)