web_server: Display trivial placeholder page if SWAT could not be found.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 16 Jan 2011 23:43:04 +0000 (00:43 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 17 Jan 2011 00:27:10 +0000 (01:27 +0100)
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Mon Jan 17 01:27:10 CET 2011 on sn-devel-104

source4/scripting/python/samba/web_server/__init__.py

index b5ac69c96a22461f6f6068044f8d9b85d7272bc4..da528f42d1ef6d84bc3f7de28dc79a714063ebe1 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-def __call__(environ, start_response):
+
+
+def render_placeholder(environ, start_response):
     status = '200 OK'
     response_headers = [('Content-type','text/html')]
     start_response(status, response_headers)
     status = '200 OK'
     response_headers = [('Content-type','text/html')]
     start_response(status, response_headers)
-    yield '<table>\n'
 
 
-    for key, value in environ.items():
-        if isinstance(value, str):
-            yield '\t<tr><td><b>%s</b></td><td>%s</td></tr>\n' % (key, value)
+    yield "<!doctype html>\n"
+    yield "<html>\n"
+    yield "  <title>The Samba web service</title>\n"
+    yield "</html>\n"
+
+    yield "<body>\n"
+    yield "<p>Welcome to this Samba web server.</p>\n"
+    yield "<p>This page is a simple placeholder. You probably want to install "
+    yield "SWAT. More information can be found "
+    yield "<a href='http://wiki.samba.org/index.php/SWAT'>on the wiki</a>.</p>"
+    yield "</p>\n"
+    yield "</body>\n"
+    yield "</html>\n"
+
+
+__call__ = render_placeholder
 
 
-    yield '</table>\n'
 
 if __name__ == '__main__':
     from wsgiref import simple_server
 
 if __name__ == '__main__':
     from wsgiref import simple_server