commit 76929be0399a941b4e4ba4ea177eafc0d088f2f5 Author: Christian Fromme kaner@strace.org Date: Mon Sep 5 20:53:30 2011 +0200
Some minor fixes. - Be less tolerant with the 'split' keyword. Apparently, Yahoo default reply sometimes makes GetTor send out split packages even though the user didnt want a split package
- Fix minor bug in package reply (actual package name and # of parts instead of "%s")
- Give more verbose stacktrace if some exception occurs --- lib/GetTor.py | 2 ++ lib/gettor/requests.py | 2 +- lib/gettor/responses.py | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/GetTor.py b/lib/GetTor.py index 716b2a9..eb5505a 100644 --- a/lib/GetTor.py +++ b/lib/GetTor.py @@ -15,6 +15,7 @@ except ImportError: import os import sys import logging +import traceback import gettor.opt import gettor.config import gettor.requests @@ -47,6 +48,7 @@ def processFail(conf, rawMessage, failedAction, e=None): """ logging.error("Failed to " + failedAction) if e is not None: + logging.error("%s" % traceback.format_exc()) logging.error("Here is the exception I saw: %s" % sys.exc_info()[0]) logging.error("Detail: %s" %e) if conf.DUMPFILE != "": diff --git a/lib/gettor/requests.py b/lib/gettor/requests.py index 1a9cdac..a67cdbe 100644 --- a/lib/gettor/requests.py +++ b/lib/gettor/requests.py @@ -113,7 +113,7 @@ class requestMail: """If we find 'split' somewhere we assume that the user wants a split delivery """ - match = re.match("\s*split.*", line, re.DOTALL) + match = re.match("^split.*", line, re.DOTALL) if match: logging.debug("User requested a split delivery") return True diff --git a/lib/gettor/responses.py b/lib/gettor/responses.py index d8bcae3..6a5adf7 100644 --- a/lib/gettor/responses.py +++ b/lib/gettor/responses.py @@ -161,7 +161,7 @@ def getSplitPackageMsg(t):
def getDelayAlertMsg(t, packageInfo): return getGreetingText(t) \ - + t.gettext(i18n.GETTOR_TEXT[38]) % packageInfo + "\n\n" \ + + t.gettext(i18n.GETTOR_TEXT[38] % packageInfo) + "\n\n" \ + t.gettext(i18n.GETTOR_TEXT[39]) + "\n\n" \ + getSupportText(t)
@@ -358,10 +358,10 @@ class Response: return False
if packageCount > 1: - packageInfo = "%s [%d parts]" \ + packageInfo = "Package: %s [%d parts]" \ % (self.reqInfo['package'], packageCount) else: - packageInfo = "%s" % self.reqInfo['package'] + packageInfo = "Package: %s" % self.reqInfo['package']
logging.info("Sending delay alert to %s" % self.reqInfo['hashed_user']) return self.sendTextEmail(getDelayAlertMsg(self.t, packageInfo))
tor-commits@lists.torproject.org