[tor-commits] [gettor/master] Don't send delay alert of split package isn't available

kaner at torproject.org kaner at torproject.org
Sat Feb 26 23:11:13 UTC 2011


commit b9e3cc38a6654edbd4de591082691abefdb17ff2
Author: Christian Fromme <kaner at strace.org>
Date:   Sun Feb 27 00:07:44 2011 +0100

    Don't send delay alert of split package isn't available
---
 lib/gettor/responses.py |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/gettor/responses.py b/lib/gettor/responses.py
index 3ef9139..4033a67 100644
--- a/lib/gettor/responses.py
+++ b/lib/gettor/responses.py
@@ -136,10 +136,6 @@ class Response:
             # Did the user choose a package?
             if self.reqInfo['package'] is None:
                 return self.sendPackageHelp()
-            # Be a polite bot and send message that mail is on the way
-            if self.config.DELAY_ALERT:
-                if not self.sendDelayAlert():
-                    logging.error("Failed to sent delay alert.")
             # Did the user request a split or normal package download?
             if self.reqInfo['split']:
                 return self.sendSplitPackage()
@@ -179,6 +175,11 @@ class Response:
         """ Send a message with an attachment to the user. The attachment is 
             chosen automatically from the selected self.reqInfo['package']
         """
+        # Be a polite bot and send message that mail is on the way
+        if self.config.DELAY_ALERT:
+	    if not self.sendDelayAlert():
+	        logging.error("Failed to sent delay alert.")
+
         pack = self.reqInfo['package']
         to = self.reqInfo['user']
         if self.isBlacklistedForMessageType("sendPackage"):
@@ -231,11 +232,16 @@ class Response:
         # Check if there's a split package for this available
         pack =  self.reqInfo['package']
         split = self.config.PACKAGES[pack][1]
-        if split and split is "unavailable":
+        if split is not None and split == "unavailable":
             logging.error("User requested split package that isn't available")
             # Inform the user
             return self.sendTextEmail(getNoSplitAvailable(self.t))
 
+        # Be a polite bot and send message that mail is on the way
+        if self.config.DELAY_ALERT:
+	    if not self.sendDelayAlert():
+	        logging.error("Failed to sent delay alert.")
+
         if self.isBlacklistedForMessageType("sendSplitPackage"):
             # Don't send anything
             return False





More information about the tor-commits mailing list