[tor-commits] [gettor/master] Fix #1568

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


commit 691516f97eb740663cfd710a7387f97bcf58254c
Author: Christian Fromme <kaner at strace.org>
Date:   Sat Feb 26 22:54:16 2011 +0100

    Fix #1568
---
 lib/gettor/i18n.py      |    7 ++++++-
 lib/gettor/responses.py |   14 ++++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/lib/gettor/i18n.py b/lib/gettor/i18n.py
index 7e5769f..9fec331 100644
--- a/lib/gettor/i18n.py
+++ b/lib/gettor/i18n.py
@@ -541,5 +541,10 @@ _("""If it doesn't arrive, the package might be too big for your mail provider.
 Try resending the mail from a GMAIL.COM or YAHOO.COM account."""),
  # GETTOR_TEXT[40]
 _("""Unfortunately we are currently experiencing problems and we can't fulfill
-your request right now. Please be patient as we try to resolve this issue.""")
+your request right now. Please be patient as we try to resolve this issue."""),
+ # GETTOR_TEXT[41]
+_("""Unfortunately there is no split package available for the package you
+requested. Please send us another package name or request the same package 
+again, but remove the 'split' keyword. In that case we'll send you the whole 
+package. Make sure this is what you want.""")
 ]
diff --git a/lib/gettor/responses.py b/lib/gettor/responses.py
index 8a992aa..3ef9139 100644
--- a/lib/gettor/responses.py
+++ b/lib/gettor/responses.py
@@ -98,6 +98,12 @@ def getDelayAlertMsg(t):
              + t.gettext(i18n.GETTOR_TEXT[27]) + "\n\n" \
              + t.gettext(i18n.GETTOR_TEXT[28]) + "\n"
 
+def getNoSplitAvailable(t):
+        return t.gettext(i18n.GETTOR_TEXT[0]) + "\n\n" \
+             + t.gettext(i18n.GETTOR_TEXT[41]) + "\n\n" \
+             + t.gettext(i18n.GETTOR_TEXT[27]) + "\n\n" \
+             + t.gettext(i18n.GETTOR_TEXT[28]) + "\n"
+
 class Response:
     def __init__(self, config, reqInfo):
         """Intialize the reply class. The most important values are passed in
@@ -222,6 +228,14 @@ class Response:
         """Send a number of messages with attachments to the user. The number
            depends on the number of parts of the package.
         """
+        # 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":
+            logging.error("User requested split package that isn't available")
+            # Inform the user
+            return self.sendTextEmail(getNoSplitAvailable(self.t))
+
         if self.isBlacklistedForMessageType("sendSplitPackage"):
             # Don't send anything
             return False





More information about the tor-commits mailing list