[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r21040: {projects} Mark plus requests (projects/gettor/lib/gettor)
Author: kaner
Date: 2009-11-28 06:50:52 -0500 (Sat, 28 Nov 2009)
New Revision: 21040
Modified:
projects/gettor/lib/gettor/requests.py
projects/gettor/lib/gettor/responses.py
Log:
Mark plus requests
Modified: projects/gettor/lib/gettor/requests.py
===================================================================
--- projects/gettor/lib/gettor/requests.py 2009-11-28 05:23:33 UTC (rev 21039)
+++ projects/gettor/lib/gettor/requests.py 2009-11-28 11:50:52 UTC (rev 21040)
@@ -46,6 +46,7 @@
self.parsedMessage = email.message_from_string(self.rawMessage)
self.signature = False
self.config = config
+ self.gotPlusReq = False
# TODO XXX:
# This should catch DNS exceptions and fail to verify if we have a
# dns timeout
@@ -69,7 +70,12 @@
splitLang = splitFrontPart[0].rsplit('+')
assert len(splitLang) > 1, "Splitting for language failed"
self.replyLocale = splitLang[1]
+ # Mark this request so that we might be able to take decisions
+ # later
+ self.gotPlusReq = True
log.info("User requested language %s" % self.replyLocale)
+ else:
+ log.info("Not a 'plus' address")
# TODO XXX:
# Scrub this data
self.replytoAddress = self.parsedMessage["from"]
@@ -108,7 +114,7 @@
self.splitDelivery = True
log.info("User requested a split delivery")
# Change locale only if none is set so far
- if self.replyLocale is not None:
+ if not self.gotPlusReq:
match = re.match(".*[Ll]ang:\s+(.*)$", line)
if match:
self.replyLocale = match.group(1)
Modified: projects/gettor/lib/gettor/responses.py
===================================================================
--- projects/gettor/lib/gettor/responses.py 2009-11-28 05:23:33 UTC (rev 21039)
+++ projects/gettor/lib/gettor/responses.py 2009-11-28 11:50:52 UTC (rev 21040)
@@ -46,7 +46,10 @@
self.mailLang = lang
# XXX If someone wants one of the localizable packages, add language
# suffix
+ # Attention though: This needs to correspond to the packages in
+ # packages.py
if package == "tor-browser-bundle" or package == "tor-im-browser-bundle":
+ # "tor-browser-bundle" => "tor-browser-bundle_de"
package = package + "_" + lang
self.package = package
self.splitsend = split