[or-cvs] r20925: {projects} Clumsy workaround for HTML stripping (in projects/gettor: . lib/gettor)
kaner at seul.org
kaner at seul.org
Sun Nov 8 20:02:12 UTC 2009
Author: kaner
Date: 2009-11-08 15:02:12 -0500 (Sun, 08 Nov 2009)
New Revision: 20925
Modified:
projects/gettor/GetTor.py
projects/gettor/lib/gettor/requests.py
Log:
Clumsy workaround for HTML stripping
Modified: projects/gettor/GetTor.py
===================================================================
--- projects/gettor/GetTor.py 2009-11-08 18:41:20 UTC (rev 20924)
+++ projects/gettor/GetTor.py 2009-11-08 20:02:12 UTC (rev 20925)
@@ -44,6 +44,7 @@
it on to the reply class/method to decide what to do."""
rawMessage = ""
+ replyTo = ""
log.info("Processing mail..")
# Retrieve request from stdin
try:
Modified: projects/gettor/lib/gettor/requests.py
===================================================================
--- projects/gettor/lib/gettor/requests.py 2009-11-08 18:41:20 UTC (rev 20924)
+++ projects/gettor/lib/gettor/requests.py 2009-11-08 20:02:12 UTC (rev 20925)
@@ -34,8 +34,7 @@
""" Read message from stdin, parse all the stuff we want to know
"""
self.rawMessage = sys.stdin.read()
- self.strippedMessage = self.stripTags(self.rawMessage)
- self.parsedMessage = email.message_from_string(self.strippedMessage)
+ self.parsedMessage = email.message_from_string(self.rawMessage)
self.signature = False
self.config = config
# TODO XXX:
@@ -67,6 +66,10 @@
# Remove quotes
if line.startswith(">"):
continue
+ # Strip HTML from line
+ # XXX: Actually we should rather read the whole body into a string
+ # and strip that. -kaner
+ line = self.stripTags(line)
# XXX This is a bit clumsy, but i cant think of a better way
# currently. A map also doesnt really help i think. -kaner
for package in self.packages.keys():
@@ -118,9 +121,9 @@
return (self.replytoAddress, self.replyLocale, self.returnPackage, \
self.splitDelivery, self.signature, self.commandaddress)
- def stripTags(self, message):
+ def stripTags(self, string):
"""Simple HTML stripper"""
- return re.sub(r'<[^>]*?>', '', message)
+ return re.sub(r'<[^>]*?>', '', string)
def getRawMessage(self):
return self.rawMessage
More information about the tor-commits
mailing list