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)
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)
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))
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))
def filter_spam(sender, request, form, **kwargs): u""" Handle spam filtering. """ from envelope.spam_filters import check_honeypot return check_honeypot(request, form)