Get rid of unused profanity filter.

This commit is contained in:
Neil Williams
2011-11-18 09:47:41 -08:00
parent 935d0c0b46
commit ee9ee8b484
4 changed files with 1 additions and 35 deletions

View File

@@ -310,8 +310,6 @@ translator_password =
takedown_sr = _takedowns
# png compressor
png_optimizer = /usr/bin/env optipng
# bad words that should be *'d out
profanity_wordlist =
# -- search --
# where is solor?

View File

@@ -327,16 +327,6 @@ class Globals(object):
print ("Warning: g.media_domain == g.domain. " +
"This may give untrusted content access to user cookies")
self.profanities = None
if self.profanity_wordlist and os.path.exists(self.profanity_wordlist):
with open(self.profanity_wordlist, 'r') as handle:
words = []
for line in handle:
words.append(line.strip(' \n\r'))
if words:
self.profanities = re.compile(r"\b(%s)\b" % '|'.join(words),
re.I | re.U)
self.reddit_host = socket.gethostname()
self.reddit_pid = os.getpid()

View File

@@ -208,9 +208,6 @@ def markdown_souptest(text, nofollow=False, target=None):
#TODO markdown should be looked up in batch?
#@memoize('markdown')
def safemarkdown(text, nofollow=False, target=None, wrap=True):
if c.user.pref_no_profanity:
text = profanity_filter(text)
if not text:
return None
@@ -234,16 +231,3 @@ def keep_space(text):
def unkeep_space(text):
return text.replace(' ', ' ').replace('
', '\n').replace('	', '\t')
def profanity_filter(text):
def _profane(m):
x = m.group(1)
return ''.join(u"\u2731" for i in xrange(len(x)))
if g.profanities:
try:
return g.profanities.sub(_profane, text)
except UnicodeDecodeError:
return text
return text

View File

@@ -29,7 +29,7 @@ from subreddit import Subreddit
from printable import Printable
from r2.config import cache
from r2.lib.memoize import memoize
from r2.lib.filters import profanity_filter, _force_utf8
from r2.lib.filters import _force_utf8
from r2.lib import utils
from r2.lib.log import log_text
from mako.filters import url_escape
@@ -449,9 +449,6 @@ class Link(Thing, Printable):
else:
item.nofollow = False
if c.user.pref_no_profanity:
item.title = profanity_filter(item.title)
item.subreddit_path = item.subreddit.path
if cname:
item.subreddit_path = ("http://" +
@@ -1124,9 +1121,6 @@ class Message(Thing, Printable):
elif item.sr_id is not None:
item.subreddit = m_subreddits[item.sr_id]
if c.user.pref_no_profanity:
item.subject = profanity_filter(item.subject)
item.is_collapsed = None
if not item.new:
if item.recipient: