[or-cvs] r16911: {projects} This integrates the very first stab at localized messages fo (in projects/gettor: . i18n i18n/de i18n/en)

ioerror at seul.org ioerror at seul.org
Mon Sep 15 05:31:59 UTC 2008


Author: ioerror
Date: 2008-09-15 01:31:59 -0400 (Mon, 15 Sep 2008)
New Revision: 16911

Added:
   projects/gettor/i18n/
   projects/gettor/i18n/de/
   projects/gettor/i18n/de/gettor_de.po
   projects/gettor/i18n/en/
   projects/gettor/i18n/en/gettor_en.po
Modified:
   projects/gettor/TODO
   projects/gettor/gettor.py
   projects/gettor/gettor_blacklist.py
   projects/gettor/gettor_log.py
   projects/gettor/gettor_responses.py
Log:
This integrates the very first stab at localized messages for local log messages. It also integrates .po files that will quickly be replaced but are a good start for testing. The responses are also localized but the user cannot request a locale, yet. This includes an updated set blacklist functions, integrating it with the configuration class. A large chunk of this code started as a patch from kaner. I took it further to create some basic tests per .py file. Furthermore, we update the TODO file with a lot of the stuff we want for the future (the next few days).


Modified: projects/gettor/TODO
===================================================================
--- projects/gettor/TODO	2008-09-14 08:48:11 UTC (rev 16910)
+++ projects/gettor/TODO	2008-09-15 05:31:59 UTC (rev 16911)
@@ -1,11 +1,9 @@
 These are planned changes to the gettor system.
 
-Localization of gettor for local logging messages:
-    - Localize all log messages
-    - We'll want to read the default language from the config file
-        - We should fall back into English for now
+Localization of all message strings:
+    - We need to implement the gnu gettext _("") code for *all* print functions
+        - A user can explictly set their program to 'stdout' if they want to test
 
-
 Fix file logging:
         - Currently logging to a file isn't implemented
             - python lacks a way to do proper semaphores (ipc fail)
@@ -18,3 +16,29 @@
             - Perhaps for now a field that specifies a locale?
     - Do we want to set a preference or make it per email?
         - For now, lets set it per email
+
+Allow for file/package configuration in the dotfile
+    - We should not hardcode the package names or files
+
+Create options that make gettor less ghetto:
+    - Add an option to allow selecting of a specific Tor mirror
+        "--use-mirror"
+    - Add proxy support for fetching
+    - Add an option to add a crontab to update a packages directory
+        "--install-crontab"
+        - Test that rsync and cron are enabled
+        - Ensure that this option selects a random time to rsync data
+    - Add an option to fetch packages from a given mirror
+        "--fetch-packages"
+    - Add an option to zip up all files in the packages directory
+        "--prep-packages"
+    - Automatically generate package list and create proper config stanza lines
+        - Currently blocked by our inability to configure package names
+        "--generate-package-list"
+    - Add an option that runs a series of tests confirming everything is OK
+        "--run-tests"
+        - Show the user all of the results
+    - Add an option that implements all of this in one easy step
+        "--setup"
+        - An alias for "--run-tests --fetch-packages --prep-packages \
+            --generate-package-list --install-crontab"

Modified: projects/gettor/gettor.py
===================================================================
--- projects/gettor/gettor.py	2008-09-14 08:48:11 UTC (rev 16910)
+++ projects/gettor/gettor.py	2008-09-15 05:31:59 UTC (rev 16911)
@@ -43,7 +43,7 @@
 """
 
 __program__ = 'gettor.py'
-__version__ = '20080714.01'
+__version__ = '20080914.01'
 __url__ = 'https://tor-svn.freehaven.net/svn/tor/trunk/contrib/gettor/'
 __author__ = 'Jacob Appelbaum <jacob at appelbaum.net>'
 __copyright__ = 'Copyright (c) 2008, Jacob Appelbaum'

Modified: projects/gettor/gettor_blacklist.py
===================================================================
--- projects/gettor/gettor_blacklist.py	2008-09-14 08:48:11 UTC (rev 16910)
+++ projects/gettor/gettor_blacklist.py	2008-09-15 05:31:59 UTC (rev 16911)
@@ -109,4 +109,5 @@
     print "Please ensure the tests match what you would expect for your environment."
 
 if __name__ == "__main__" :
+    print "It appears that you're manually calling the blacklisting code. We'll run some tests..."
     blackListtests("requestingUser at example.com")

Modified: projects/gettor/gettor_log.py
===================================================================
--- projects/gettor/gettor_log.py	2008-09-14 08:48:11 UTC (rev 16910)
+++ projects/gettor/gettor_log.py	2008-09-15 05:31:59 UTC (rev 16911)
@@ -8,7 +8,6 @@
 
 import os
 import sys
-#import threading
 from time import gmtime, strftime
 import ConfigParser
 import syslog
@@ -25,9 +24,6 @@
     pid       = str(os.getpid())
     logPrefix = "gettor (pid " + pid + ") "
 
-    # We can't get real shm ipc with python currently :-(
-    #sem     = BoundedSemaphore(1)
-
     def _init_(self):  
         # parse the configuration file so we know how we're running 
         if logger == "file":
@@ -40,19 +36,24 @@
         now = strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
         message = self.logPrefix + now + " : "+ message
 
-        # Log the message
-        if self.logger == "syslog":
+        # By default, we'll just drop the message
+        if self.logger == "nothing":
+            return True
+
+        # Other options for logging the message follow
+        elif self.logger == "syslog":
             syslog.syslog(message)
             
         elif self.logger == "file":
-            #sem.aquire()
             self.logfd.write(message)
             self.logfd.close()
-            #sem.release()
 
         elif self.logger == "stdout":
             print message
 
 if __name__ == "__main__" :
     l = gettorLogger()
+    print "This is the logging module. You probably do not want to call it by hand."
+    print "We'll send a test logging message now with the following subsystem: " + \
+    str(l.logger)
     l.log("I'm a logger, logging!")

Modified: projects/gettor/gettor_responses.py
===================================================================
--- projects/gettor/gettor_responses.py	2008-09-14 08:48:11 UTC (rev 16910)
+++ projects/gettor/gettor_responses.py	2008-09-15 05:31:59 UTC (rev 16911)
@@ -64,3 +64,6 @@
 
     return status
 
+if __name__ == "__main__" :
+    print "This is the response handling code. You probably do not want to call it by hand."
+

Added: projects/gettor/i18n/de/gettor_de.po
===================================================================
--- projects/gettor/i18n/de/gettor_de.po	                        (rev 0)
+++ projects/gettor/i18n/de/gettor_de.po	2008-09-15 05:31:59 UTC (rev 16911)
@@ -0,0 +1,150 @@
+# gettor translation file for .de
+# Copyright (C) The Tor project
+# Christian Fromme <kaner at strace.org>, 2008.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: 1.0\n"
+"POT-Creation-Date: 2008-09-14 16:24+CEST\n"
+"PO-Revision-Date: 2008-09-14 16:24+CEST\n"
+"Last-Translator: Christian Fromme <kaner at strace.org>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: ENCODING\n"
+"Generated-By: pygettext.py 1.5\n"
+
+
+#: gettor.py:75
+msgid "No parsed message. Dropping message."
+msgstr "Konnte die Nachricht nicht parsen. Loesche Nachricht."
+
+#: gettor.py:80
+msgid "Signature is: %s"
+msgstr "Die Signatur ist: %s"
+
+#: gettor.py:107
+msgid "No help dispatched. Invalid reply address for user."
+msgstr "Keine Hilfe versendet. Die Antwortadresse des Users ist ungueltig."
+
+#: gettor.py:111
+msgid "Unsigned messaged to gettor by blacklisted user dropped."
+msgstr "gettor: Unsignierte Nachricht an gettor von einem blacklisted User geloescht."
+
+#: gettor.py:117
+msgid ""
+"\n"
+"Hello! This is the \"get tor\" robot.\n"
+"\n"
+"Unfortunately, we won't answer you at this address. We only process\n"
+"requests from email services that support \"DKIM\", which is an email\n"
+"feature that lets us verify that the address in the \"From\" line is\n"
+"actually the one who sent the mail.\n"
+"\n"
+"Gmail and Yahoo Mail both use DKIM. You will have better luck sending\n"
+"us mail from one of those.\n"
+"\n"
+"(We apologize if you didn't ask for this mail. Since your email is from\n"
+"a service that doesn't use DKIM, we're sending a short explanation,\n"
+"and then we'll ignore this email address for the next day or so.\n"
+"        "
+msgstr ""
+"\n"
+"Hallo! Diese Nachricht kommt vom \"get tor\" robot.\n"
+"\n"
+"Leider koennen wir Ihnen auf diese Adresse nicht antworten. Wir koennen\n"
+"nur Requests von Email-Diensten verarbeiten, die den \"DKIM\"-Service\n"
+"unterstuetzen. DKIM ist ein Dienst, der uns ueberpruefen laesst, ob die\n"
+"Absenderadresse einer Email tatsaechlich von dort kommt, woher sie\n"
+"vorgibt zu kommen.\n"
+"\n"
+"(Bitte entschuldigen Sie, wenn diese Email Sie ohne ihr zutuen erreicht.\n"
+"Da diese Email ohnehin von einer Adresse kam, die kein DKIM unterstuetzt,\n"
+"senden wir nur diese kurze Erklaerung und ignorieren Ihre Adresse fuer\n"
+"den naechsten Tag.)\n"
+"        "
+
+#: gettor.py:133
+msgid "Unsigned messaged to gettor. We issued some help about using DKIM."
+msgstr "Unsignierte Nachricht. Hilfe zu DKIM versandt."
+
+#: gettor.py:137
+msgid "Signed messaged to gettor."
+msgstr "Signierte Nachricht empfangen."
+
+#: gettor.py:145
+msgid "Package: %s selected."
+msgstr "Paket: %s gewaehlt."
+
+#: gettor.py:146
+msgid ""
+"\n"
+"Here's your requested software as a zip file. Please unzip the \n"
+"package and verify the signature.\n"
+"            "
+msgstr ""
+"\n"
+"Hier ist die von Ihnen angeforderte Software als Zip-datei. Bitte\n"
+"entpacken Sie diese und verifizieren Sie die digitale Signatur.\n"
+"            "
+
+#: gettor.py:153
+msgid "Hello, I'm a robot. "
+msgstr "Hallo, Ich bin der automatische Mail-Versandt"
+
+#: gettor.py:154
+msgid ""
+"Your request was not understood. Please select one of the following package names:\n"
+msgstr ""
+"Ihre Anfrage war nicht zu verstehen. Bitte waehlen Sie eines der folgenden Paketnamen:\n"
+
+#: gettor.py:158
+msgid ""
+"Please send me another email. It only needs a single package name anywhere in the body of your email.\n"
+msgstr ""
+"Bitte senden Sie mir eine weitere Email. Schreiben Sie darin lediglich den Paketnamen.\n"
+
+#: gettor.py:160
+msgid "Signed messaged to gettor. We issued some help about proper email formatting."
+msgstr "Signierte Nachricht empfangen. Hilfe ueber das richtige formatieren von Email versandt."
+
+#: gettor_requests.py:65
+msgid "Fetching raw message."
+msgstr "Hole Nachricht im Raw-Format."
+
+#: gettor_requests.py:68
+msgid "Verifying signature of message."
+msgstr "Verifiziere Signatur der Nachricht."
+
+#: gettor_requests.py:70
+msgid "Parsing Message."
+msgstr "Verarbeite Nachricht."
+
+#: gettor_requests.py:72
+msgid "Parsing reply."
+msgstr "Verarbeite Antwort."
+
+#: gettor_requests.py:74
+msgid "Parsing package request."
+msgstr "Verarbeite Paketanfrage."
+
+#: gettor_requests.py:81
+msgid "The signature status of the email is: %s"
+msgstr "Der Signatur-Status dieser Email ist: %s"
+
+#: gettor_requests.py:82
+msgid "The email requested the following reply address: %s"
+msgstr "Die verlangte Email hat folgende Antwortadresse: %s"
+
+#: gettor_requests.py:83
+msgid "It looks like the email requested the following package: %s"
+msgstr "Es sieht aus als wuerde die Email folgendes Paket anfodern: %s"
+
+#: gettor_requests.py:84
+msgid "We would select the following package file: "
+msgstr "Folgendes Paket wird ausgeaehlt: "
+
+#: gettor_responses.py:35
+msgid "Re: Your \"get tor\" request"
+msgstr "Re: Ihre \"get tor\" Anfrage"
+

Added: projects/gettor/i18n/en/gettor_en.po
===================================================================
--- projects/gettor/i18n/en/gettor_en.po	                        (rev 0)
+++ projects/gettor/i18n/en/gettor_en.po	2008-09-15 05:31:59 UTC (rev 16911)
@@ -0,0 +1,130 @@
+# gettor translation file for .de
+# Copyright (C) The Tor project
+# Christian Fromme <kaner at strace.org>, 2008.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: 1.0\n"
+"POT-Creation-Date: 2008-09-14 16:24+CEST\n"
+"PO-Revision-Date: 2008-09-14 16:24+CEST\n"
+"Last-Translator: Christian Fromme <kaner at strace.org>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: ENCODING\n"
+"Generated-By: pygettext.py 1.5\n"
+
+
+#: gettor.py:75
+msgid "No parsed message. Dropping message."
+msgstr ""
+
+#: gettor.py:80
+msgid "Signature is: %s"
+msgstr ""
+
+#: gettor.py:107
+msgid "No help dispatched. Invalid reply address for user."
+msgstr ""
+
+#: gettor.py:111
+msgid "Unsigned messaged to gettor by blacklisted user dropped."
+msgstr ""
+
+#: gettor.py:117
+msgid ""
+"\n"
+"Hello! This is the \"get tor\" robot.\n"
+"\n"
+"Unfortunately, we won't answer you at this address. We only process\n"
+"requests from email services that support \"DKIM\", which is an email\n"
+"feature that lets us verify that the address in the \"From\" line is\n"
+"actually the one who sent the mail.\n"
+"\n"
+"Gmail and Yahoo Mail both use DKIM. You will have better luck sending\n"
+"us mail from one of those.\n"
+"\n"
+"(We apologize if you didn't ask for this mail. Since your email is from\n"
+"a service that doesn't use DKIM, we're sending a short explanation,\n"
+"and then we'll ignore this email address for the next day or so.\n"
+"        "
+msgstr ""
+
+#: gettor.py:133
+msgid "Unsigned messaged to gettor. We issued some help about using DKIM."
+msgstr ""
+
+#: gettor.py:137
+msgid "Signed messaged to gettor."
+msgstr ""
+
+#: gettor.py:145
+msgid "Package: %s selected."
+msgstr ""
+
+#: gettor.py:146
+msgid ""
+"\n"
+"Here's your requested software as a zip file. Please unzip the \n"
+"package and verify the signature.\n"
+"            "
+msgstr ""
+
+#: gettor.py:153
+msgid "Hello, I'm a robot. "
+msgstr ""
+
+#: gettor.py:154
+msgid ""
+"Your request was not understood. Please select one of the following package names:\n"
+msgstr ""
+
+#: gettor.py:158
+msgid ""
+"Please send me another email. It only needs a single package name anywhere in the body of your email.\n"
+msgstr ""
+
+#: gettor.py:160
+msgid "Signed messaged to gettor. We issued some help about proper email formatting."
+msgstr ""
+
+#: gettor_requests.py:65
+msgid "Fetching raw message."
+msgstr ""
+
+#: gettor_requests.py:68
+msgid "Verifying signature of message."
+msgstr ""
+
+#: gettor_requests.py:70
+msgid "Parsing Message."
+msgstr ""
+
+#: gettor_requests.py:72
+msgid "Parsing reply."
+msgstr ""
+
+#: gettor_requests.py:74
+msgid "Parsing package request."
+msgstr ""
+
+#: gettor_requests.py:81
+msgid "The signature status of the email is: %s"
+msgstr ""
+
+#: gettor_requests.py:82
+msgid "The email requested the following reply address: %s"
+msgstr ""
+
+#: gettor_requests.py:83
+msgid "It looks like the email requested the following package: %s"
+msgstr ""
+
+#: gettor_requests.py:84
+msgid "We would select the following package file: "
+msgstr ""
+
+#: gettor_responses.py:35
+msgid "Re: Your \"get tor\" request"
+msgstr ""
+



More information about the tor-commits mailing list