[tor-commits] [gettor/master] Add arma's suggestions for help text enhancement.

kaner at torproject.org kaner at torproject.org
Sat Sep 3 12:35:54 UTC 2011


commit b9b714efd53ed7f5ce954f3456c174cb87e46226
Author: Christian Fromme <kaner at strace.org>
Date:   Tue Aug 30 14:25:00 2011 +0200

    Add arma's suggestions for help text enhancement.
    Also fix a bug in email alias handling.
    
    Closes:
---
 lib/gettor/filters.py   |    4 ++++
 lib/gettor/i18n.py      |   39 ++++++++++++++++++---------------------
 lib/gettor/requests.py  |    4 ++--
 lib/gettor/responses.py |   31 ++++++++++++++++++++-----------
 4 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/lib/gettor/filters.py b/lib/gettor/filters.py
index ff0cfb4..9825e8f 100644
--- a/lib/gettor/filters.py
+++ b/lib/gettor/filters.py
@@ -18,6 +18,10 @@ def doPackageHacks(packageName, locale):
        suffix. This isn't nice because we're hard-coding package names here
        Attention: This needs to correspond to the  packages in packages.py
     """
+    # If someone sent a request for a "tor-browser-bundle" (whatever that is ;)
+    # we reply with a "windows" package
+    if packageName == "tor-browser-bundle":
+       packageName = "windows"
     if packageName == "windows" \
            or packageName == "linux-i386" \
            or packageName == "linux-x86_64":
diff --git a/lib/gettor/i18n.py b/lib/gettor/i18n.py
index 54e365e..186b518 100644
--- a/lib/gettor/i18n.py
+++ b/lib/gettor/i18n.py
@@ -28,7 +28,7 @@ _("""Hello, This is the "GetTor" robot."""),
  # GETTOR_TEXT[1]
 _("""Thank you for your request."""),
  # GETTOR_TEXT[2]
-_(""" Unfortunately, we won't answer you at this address. You should make
+_("""Unfortunately, we won't answer you at this address. You should make
 an account with GMAIL.COM, YAHOO.COM or YAHOO.CN and send the mail from
 one of those."""),
  # GETTOR_TEXT[3]
@@ -62,10 +62,10 @@ _("""OBTAINING LOCALIZED VERSIONS OF TOR
 _("""To get a version of Tor translated into your language, specify the
 language you want in the address you send the mail to:
 
-    gettor+zh_CN at torproject.org"""),
+    gettor+fa at torproject.org"""),
  # GETTOR_TEXT[10]
 _("""This example will give you the requested package in a localized
-version for Chinese. Check below for a list of supported language
+version for Farsi (Persian). Check below for a list of supported language
 codes. """),
  # GETTOR_TEXT[11]
 _(""" List of supported locales:"""),
@@ -89,12 +89,12 @@ _("""If you select no language, you will receive the English version."""),
 _("""SMALLER SIZED PACKAGES
 ======================"""),
  # GETTOR_TEXT[16]
-_("""If your bandwith is low or your provider doesn't allow you to 
-receive large attachments in your email, there is a feature of 
-GetTor you can use to make it send you a number of small packages
-instead of one big one."""),
+_("""If your bandwith is low or your provider doesn't allow you to
+receive large attachments in your email, GetTor can send you several
+small packages instead of one big one."""),
  # GETTOR_TEXT[17]
-_("""Simply include the keyword 'split' somewhere in your email like so:
+_("""Simply include the keyword 'split' in a new line on its own (this part
+is important!) like so: 
         
     windows
     split"""),
@@ -130,7 +130,7 @@ _("""SUPPORT
 _("""If you have any questions or it doesn't work, you can contact a
 human at this support email address: tor-assistants at torproject.org"""),
  # GETTOR_TEXT[28]
-_(""" Here's your requested software as a zip file. Please unzip the
+_("""Here's your requested software as a zip file. Please unzip the
 package and verify the signature."""),
  # GETTOR_TEXT[29]
 _("""VERIFY SIGNATURE
@@ -177,7 +177,7 @@ _("""Packages might arrive out of order! Please make sure you received
 all packages before you attempt to unpack them!"""),
  # GETTOR_TEXT[38]
 _("""It was successfully understood. Your request is currently being processed.
-Your package should arrive within the next ten minutes."""),
+Your package (%s) should arrive within the next ten minutes."""),
  # GETTOR_TEXT[39]
 _("""If it doesn't arrive, the package might be too big for your mail provider.
 Try resending the mail from a GMAIL.COM, YAHOO.CN or YAHOO.COM account."""),
@@ -193,10 +193,9 @@ package. Make sure this is what you want."""),
 _("""UNPACKING THE FILES
 ==================="""),
  # GETTOR_TEXT[43]
-_("""To unpack the files you received, there's a number of alternatives on
-how to do it. The easiest way is to install 7-Zip, a free file compression/
-uncompression tool. If it isn't installed on your computer yet, you can
-download it here:
+_("""The easiest way to unpack the files you received is to install 7-Zip,
+a free file compression/uncompression tool. If it isn't installed on
+your computer yet, you can download it here:
 
     http://www.7-zip.org/"""),
  # GETTOR_TEXT[44]
@@ -208,9 +207,8 @@ _("""An alternative way to get the .z files extraced is to rename them to
 "windows.zip". You should then be able to extract the archive with common 
 file archiver programs that probably are already installed on your computer."""),
  # GETTOR_TEXT[46]
-_("""Please reply to this mail, and tell me a single package name anywhere in 
-the body of your email. To make your decision a bit easier, here's a 
-short explanation of what these packages are:"""),
+_("""Please reply to this mail, and tell me a single package name anywhere
+in your reply. Here's a short explanation of what these packages are:"""),
  # GETTOR_TEXT[47]
 _("""windows:
 The Tor Browser Bundle package for Windows operating systems. If you're 
@@ -222,8 +220,8 @@ The Tor Browser Bundle package for OS X, Intel CPU architecture. In
 general, newer Mac hardware will require you to use this package."""),
  # GETTOR_TEXT[49]
 _("""macos-ppc:
-This is a Vidalia Bundle for older Macs running OS X on PowerPC CPUs. 
-Note that this package will be deprecated soon."""),
+This is an older installer (the "Vidalia bundle") for older Macs running
+OS X on PowerPC CPUs. Note that this package will be deprecated soon."""),
  # GETTOR_TEXT[50]
 _("""linux-i386:
 The Tor Browser Bundle package for Linux, 32bit versions."""),
@@ -235,8 +233,7 @@ _("""linux-x86_64:
 The Tor Browser Bundle package for Linux, 64bit versions."""),
  # GETTOR_TEXT[53]
 _("""source:
-The Tor source code. Only request this package if you know what you're 
-doing. This isn't the package a normal user wants."""),
+The Tor source code, for experts. Most users do not want this package."""),
  # GETTOR_TEXT[54]
 _("""FREQUENTLY ASKED QUESTIONS
 =========================="""),
diff --git a/lib/gettor/requests.py b/lib/gettor/requests.py
index 977b776..b29e335 100644
--- a/lib/gettor/requests.py
+++ b/lib/gettor/requests.py
@@ -153,14 +153,14 @@ class requestMail:
                 return locale
             if aliases is not None:
                 if locale in aliases:
-                    logging.debug("Request for %s via alias %s" % (lang, alias))
+                    logging.debug("Request for %s via alias %s" % (lang, locale))
                     # Return the 'official' name
                     return lang
         else:
             logging.debug("Requested language %s not supported. Fallback: %s" \
                               % (self.replyLocale, self.config.DEFAULT_LOCALE))
             self.replyLocale = self.config.DEFAULT_LOCALE
-            return
+            return self.config.DEFAULT_LOCALE
 
     def getRawMessage(self):
         return self.rawMessage
diff --git a/lib/gettor/responses.py b/lib/gettor/responses.py
index bf1d2cb..0f3d2f8 100644
--- a/lib/gettor/responses.py
+++ b/lib/gettor/responses.py
@@ -142,9 +142,9 @@ def getInitialHelpMsg(t, config):
 def getPackageMsg(t):
     return getGreetingText(t) \
          + t.gettext(i18n.GETTOR_TEXT[28]) + "\n\n" \
-         + getVerifySignatureText(t) \
          + getUnpackingText(t) \
          + getBridgesHelpText(t) \
+         + getVerifySignatureText(t) \
          + getFAQText(t) \
          + getSupportText(t)
 
@@ -157,9 +157,9 @@ def getSplitPackageMsg(t):
          + getFAQText(t) \
          + getSupportText(t)
 
-def getDelayAlertMsg(t):
+def getDelayAlertMsg(t, packageInfo):
     return getGreetingText(t) \
-         + t.gettext(i18n.GETTOR_TEXT[38]) + "\n\n" \
+         + t.gettext(i18n.GETTOR_TEXT[38]) % packageInfo + "\n\n" \
          + t.gettext(i18n.GETTOR_TEXT[39]) + "\n\n" \
          + getSupportText(t)
 
@@ -305,11 +305,6 @@ class Response:
             # 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
@@ -321,6 +316,12 @@ class Response:
         splitpack = self.reqInfo['package'] + ".split"
         splitDir = os.path.join(self.config.BASEDIR, "packages", splitpack)
         fileList = os.listdir(splitDir)
+
+        # 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.")
+
         # Sort the files, so we can send 01 before 02 and so on..
         fileList.sort()
         nFiles = len(fileList)
@@ -344,14 +345,22 @@ class Response:
 
         return status
 
-    def sendDelayAlert(self):
-        """Send a polite delay notification
+    def sendDelayAlert(self, packageCount=1):
+        """Send a polite delay notification. Add the number of packages that
+           the user can expect to arrive.
         """
         if self.isBlacklistedForMessageType("sendDelayAlert"):
             # Don't send anything
             return False
+
+        if packageCount > 1:
+            packageInfo = "%s [%d parts]" \
+                           % (self.reqInfo['package'], packageCount)
+        else:
+            packageInfo = self.reqInfo['package']
+
         logging.info("Sending delay alert to %s" % self.reqInfo['hashed_user'])
-        return self.sendTextEmail(getDelayAlertMsg(self.t))
+        return self.sendTextEmail(getDelayAlertMsg(self.t), packageInfo)
             
     def sendHelp(self):
         """Send a help mail. This happens when a user sent us a request we 





More information about the tor-commits mailing list