diff --git a/r2/example.ini b/r2/example.ini index c01c44f83..a14b1c8e6 100755 --- a/r2/example.ini +++ b/r2/example.ini @@ -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? diff --git a/r2/r2/lib/app_globals.py b/r2/r2/lib/app_globals.py index 575eb1163..e091c4d80 100755 --- a/r2/r2/lib/app_globals.py +++ b/r2/r2/lib/app_globals.py @@ -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() diff --git a/r2/r2/lib/filters.py b/r2/r2/lib/filters.py index c120f7a67..5c5836466 100644 --- a/r2/r2/lib/filters.py +++ b/r2/r2/lib/filters.py @@ -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 diff --git a/r2/r2/models/link.py b/r2/r2/models/link.py index 58cbafb14..b8996c8fe 100644 --- a/r2/r2/models/link.py +++ b/r2/r2/models/link.py @@ -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: