attrs=None, html_comment=False, *args, **kwargs): self.html_comment = html_comment super(HoneypotWidget, self).__init__(attrs, *args, **kwargs) if not self.attrs.has_key('class'): self.attrs['style'] = 'display:none' def render(self, *args, **kwargs): value = super(HoneypotWidget, self).render(*args, **kwargs) if self.html_comment: value = '<!-- %s -->' % value return value class HoneypotField(forms.Field): widget = HoneypotWidget def clean(self, value): EMPTY_VALUES = (None, '') if self.initial in EMPTY_VALUES and value in EMPTY_VALUES or value == self.initial: return value raise forms.ValidationError('2+2')
of known forum and blog spammers. The database provides their email addresses, IP addresses, usernames, spamming frequency, and, in some cases, evidence of their spam.
219\.(7[6-7])\. deny from 218\.250\. deny from 218\.(10[2-3])\. deny from 211\.157\.(10[0-9]¦11[0-9]¦12[0-7])\. </Directory> <Directory "/var/www/html"> Include /var/tmp/blocked_ips.conf </Directory> Apache conf?
compile_paths(path_list): paths = [] for path in path_list: if path.startswith("/"): paths.append(path) else: paths.append(reverse(path)) return paths if not request.method == 'POST': return if sfs_settings.ALL_POST_REQUESTS: if request.path in compile_paths(sfs_settings.URLS_IGNORE): return return self.check_request_ip(request) if request.path in compile_paths(sfs_settings.URLS_INCLUDE): return self.check_request_ip(request)
day Determined by IP. If you host many sites, use: wget -O /path/file.zip URL Site 1: manage.py sfsupdate Site 2: manage.py sfsupdate ... settings.SFS_SOURCE_ZIP = "file:///path/to/listed_ip_7.zip"