[or-cvs] [bridgedb/master] Display a useful message if no e-mail domains are supported.

nickm at torproject.org nickm at torproject.org
Mon Feb 14 20:54:15 UTC 2011


commit 8002dfc8922d059d1274d40dd0de6e2e9879e760
Author: Robert Ransom <rransom.8774 at gmail.com>
Date:   Sat Dec 11 19:38:12 2010 -0800

    Display a useful message if no e-mail domains are supported.
---
 lib/bridgedb/Server.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/bridgedb/Server.py b/lib/bridgedb/Server.py
index 0b674bf..1ce07cb 100644
--- a/lib/bridgedb/Server.py
+++ b/lib/bridgedb/Server.py
@@ -95,6 +95,11 @@ class WebResource(twisted.web.resource.Resource):
 
     def buildHTMLMessageTemplate(self, t):
         """DOCDOC"""
+        if self.domains:
+            email_domain_list = "<ul>" \
+                + "".join(("<li>%s</li>"%d for d in self.domains)) + "</ul>"
+        else:
+            email_domain_list = "<p>E-mail requests not supported!</p>"
         html_msg = "<html><body>" \
                    + "<p>" + t.gettext(I18n.BRIDGEDB_TEXT[0]) \
                    + "<pre id=\"bridges\">" \
@@ -104,8 +109,7 @@ class WebResource(twisted.web.resource.Resource):
                    + "<p>" + t.gettext(I18n.BRIDGEDB_TEXT[2]) + "</p>" \
                    + "<p>" + t.gettext(I18n.BRIDGEDB_TEXT[3]) + "</p>" \
                    + "<p>" + t.gettext(I18n.BRIDGEDB_TEXT[4]) + "</p>" \
-                   + "<ul>" \
-                   + "".join(("<li>%s</li>"%d for d in self.domains)) + "</ul>"\
+                   + email_domain_list \
                    + "</body></html>"
 
         return html_msg





More information about the tor-commits mailing list