1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-09 20:59:11 +03:00

web_server: Display trivial placeholder page if SWAT could not be found.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Mon Jan 17 01:27:10 CET 2011 on sn-devel-104
This commit is contained in:
Jelmer Vernooij
2011-01-17 00:43:04 +01:00
parent 7982f683ee
commit e665fce31c

View File

@ -20,17 +20,30 @@
# 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)
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