[or-cvs] r20924: {projects} -Sort TODO file a bit more by priorities -Try sending a "gen (in projects/gettor: . lib/gettor)
kaner at seul.org
kaner at seul.org
Sun Nov 8 18:41:20 UTC 2009
Author: kaner
Date: 2009-11-08 13:41:20 -0500 (Sun, 08 Nov 2009)
New Revision: 20924
Modified:
projects/gettor/GetTor.py
projects/gettor/TODO
projects/gettor/lib/gettor/constants.py
projects/gettor/lib/gettor/responses.py
Log:
-Sort TODO file a bit more by priorities
-Try sending a "generic error" message to the user after processing of his mail failed
Modified: projects/gettor/GetTor.py
===================================================================
--- projects/gettor/GetTor.py 2009-11-08 17:35:51 UTC (rev 20923)
+++ projects/gettor/GetTor.py 2009-11-08 18:41:20 UTC (rev 20924)
@@ -23,6 +23,17 @@
log = gettor.gtlog.getLogger()
+def processFail(conf, rawMessage, sendTo):
+ """This routine gets called when something went wrong with the processing"""
+ # Keep a copy of the failed email for later reference
+ log.info("We'll keep a record of this mail.")
+ gettor.utils.dumpMessage(conf, rawMessage)
+ # Send out notification to user, if possible
+ if not gettor.responses.sendNotification(conf, sendTo):
+ log.error("Also failed to send the user a proper notification. :-/")
+ else:
+ log.info("Failure notification sent to user %s" % sendTo)
+
def processMail(conf):
"""All mail processing happens here. Processing goes as follows:
- Parse request. This means: Find out everything we need to reply in
@@ -46,8 +57,7 @@
log.error("Parsing the request failed.")
log.error("Here is the exception I saw: %s" % sys.exc_info()[0])
log.error("Detail: %s" % e)
- # Keep a copy of the failed email for later reference
- gettor.utils.dumpMessage(conf, rawMessage)
+ processFail(conf, rawMessage, replyTo)
return False
# Ok, information aquired. Initiate reply sequence
@@ -55,16 +65,15 @@
reply = gettor.responses.Response(conf, replyTo, lang, pack, split, \
sig, cmdAddr)
if not reply.sendReply():
- log.error("Sending reply failed. We'll keep a record of this mail")
- gettor.utils.dumpMessage(conf, rawMessage)
+ log.error("Sending reply failed.")
+ processFail(conf, rawMessage, replyTo)
return False
return True
except Exception, e:
log.error("Sending the reply failed.")
log.error("Here is the exception I saw: %s" % sys.exc_info()[0])
log.error("Detail: %s" %e)
- # Keep a copy of the failed email for later reference
- gettor.utils.dumpMessage(conf, rawMessage)
+ processFail(conf, rawMessage, replyTo)
raise
return False
Modified: projects/gettor/TODO
===================================================================
--- projects/gettor/TODO 2009-11-08 17:35:51 UTC (rev 20923)
+++ projects/gettor/TODO 2009-11-08 18:41:20 UTC (rev 20924)
@@ -2,17 +2,16 @@
- Testing and proposals to better support users with limited email bandwidth
(multi-part download, etc.).
-- Write spec for how locale requests shall be formatted and parsed
-- Implement test (-t switch) functionality
- Split (at least) tiger bundle into several smaller archives to avoid ~20MB
- Add more translations
- Freeze messages for translation
- Put po files into pootle for translation
-- Add GetTor to GetTor and it will be able to distribute itself
-- Add torbutton (Mike, please sign torbutton and populate a proper .asc)
-- Fix rsync to follow symlinks properly. We want the data not a link to data.
-- Remove 'localhost:25' to send mail and use '/usr/bin/sendmail' instead
- (suggested by weasel)
- Package names that are sent out to the user are currently hard-coded. Return
to a more dynamic approach, also: Add a nice little note about the size of
the files users may request
+- Fix rsync to follow symlinks properly. We want the data not a link to data.
+- Remove 'localhost:25' to send mail and use '/usr/bin/sendmail' instead
+ (suggested by weasel)
+- Implement test (-t switch) functionality
+- Add torbutton (Mike, please sign torbutton and populate a proper .asc)
+- Add GetTor to GetTor and it will be able to distribute itself
Modified: projects/gettor/lib/gettor/constants.py
===================================================================
--- projects/gettor/lib/gettor/constants.py 2009-11-08 17:35:51 UTC (rev 20923)
+++ projects/gettor/lib/gettor/constants.py 2009-11-08 18:41:20 UTC (rev 20924)
@@ -162,3 +162,14 @@
human at this support email address: tor-assistants at torproject.org
""")
+
+mailfailmsg = _("""
+ Hello, This is the "GetTor" robot.
+
+ Thank you for your request.
+
+ Unfortunatly we are currently experiencing problems and we can't fulfill
+ your request right now. Please be patient as we try to resolve this issue.
+
+ """)
+
Modified: projects/gettor/lib/gettor/responses.py
===================================================================
--- projects/gettor/lib/gettor/responses.py 2009-11-08 17:35:51 UTC (rev 20923)
+++ projects/gettor/lib/gettor/responses.py 2009-11-08 18:41:20 UTC (rev 20924)
@@ -27,6 +27,12 @@
log = gettor.gtlog.getLogger()
+def sendNotification(config, sendTo):
+ """Send notification to user"""
+ response = Response(config, sendTo, "en", "", False, True, "")
+ message = gettor.constants.mailfailmsg
+ return response.sendGenericMessage(message)
+
class Response:
def __init__(self, config, replyto, lang, package, split, signature, caddr):
More information about the tor-commits
mailing list