[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r13062: Send a "no bridges" email rather than no email when no bridg (in bridgedb/trunk: . lib/bridgedb)



Author: nickm
Date: 2008-01-07 15:58:09 -0500 (Mon, 07 Jan 2008)
New Revision: 13062

Modified:
   bridgedb/trunk/
   bridgedb/trunk/lib/bridgedb/Server.py
Log:
 r17511@catbus:  nickm | 2008-01-07 15:26:09 -0500
 Send a "no bridges" email rather than no email when no bridges are available.



Property changes on: bridgedb/trunk
___________________________________________________________________
 svk:merge ticket from /bridgedb/trunk [r17511] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: bridgedb/trunk/lib/bridgedb/Server.py
===================================================================
--- bridgedb/trunk/lib/bridgedb/Server.py	2008-01-07 20:58:07 UTC (rev 13061)
+++ bridgedb/trunk/lib/bridgedb/Server.py	2008-01-07 20:58:09 UTC (rev 13062)
@@ -180,9 +180,6 @@
         logging.info("Got a mail from a bad email address %r: %s.",
                      clientAddr, e)
         return None, None
-    if not bridges:
-        logging.warning("No bridges available to send to %r", clientAddr)
-        return None, None
 
     # Generate the message.
     f = StringIO()
@@ -197,7 +194,10 @@
     w.addheader("Date", twisted.mail.smtp.rfc822date())
     body = w.startbody("text/plain")
 
-    answer = "".join("  %s\n" % b.getConfigLine() for b in bridges)
+    if bridges:
+        answer = "".join("  %s\n" % b.getConfigLine() for b in bridges)
+    else:
+        answer = "(no bridges currently available)"
     body.write(EMAIL_MESSAGE_TEMPLATE % answer)
 
     f.seek(0)