Removed unused import, PEP8 cleanups

This commit is contained in:
Roberto Rosario
2011-08-12 02:13:23 -04:00
parent 09f1c2bd2f
commit 0a2591d58f
38 changed files with 295 additions and 142 deletions

View File

@@ -5,9 +5,11 @@ from django.utils.translation import ugettext
# From http://www.peterbe.com/plog/whitelist-blacklist-logic
def accept_item(value, whitelist, blacklist, default_accept=True):
""" return true if this item is either whitelisted or
not blacklisted """
def accept_item(value, whitelist, blacklist, default_accept=True):
"""
return true if this item is either whitelisted or
not blacklisted
"""
if not whitelist:
whitelist = []
@@ -18,9 +20,9 @@ def accept_item(value, whitelist, blacklist, default_accept=True):
for reject, item_list in ([False, whitelist], [True, blacklist]):
#print 'item_list: %s' % item_list
#print 'reject: %s' % reject
for okpattern in item_list:
for okpattern in item_list:
#print 'okpattern: %s' % okpattern
if re.findall(okpattern.replace('*','\S+'), value, re.I):
if re.findall(okpattern.replace('*', '\S+'), value, re.I):
# match!
#print 'MATCH'
if reject: