s4-python: Remove env from non-executable webserver script.
[Samba/vl.git] / source4 / scripting / python / samba / web_server / __init__.py
blobc43924097d1c7e5fcbdab04bf6469e15f441ce86
1 # -*- coding: utf-8 -*-
3 # Unix SMB/CIFS implementation.
4 # Copyright © Jelmer Vernooij <jelmer@samba.org> 2008
6 # Implementation of SWAT that uses WSGI
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 def render_placeholder(environ, start_response):
25 status = '200 OK'
26 response_headers = [('Content-type', 'text/html')]
27 start_response(status, response_headers)
29 yield "<!doctype html>\n"
30 yield "<html>\n"
31 yield " <title>The Samba web service</title>\n"
32 yield "</html>\n"
34 yield "<body>\n"
35 yield "<p>Welcome to this Samba web server.</p>\n"
36 yield "<p>This page is a simple placeholder. You probably want to install "
37 yield "SWAT. More information can be found "
38 yield "<a href='http://wiki.samba.org/index.php/SWAT'>on the wiki</a>.</p>"
39 yield "</p>\n"
40 yield "</body>\n"
41 yield "</html>\n"
44 __call__ = render_placeholder
47 if __name__ == '__main__':
48 from wsgiref import simple_server
49 httpd = simple_server.make_server('localhost', 8090, __call__)
50 print "Serving HTTP on port 8090..."
51 httpd.serve_forever()