diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2011-01-17 00:25:42 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-01-17 00:25:42 +0100 |
commit | 04abf2cc8dfda2a969cd2c1257d5d5a41979a0d2 (patch) | |
tree | c7d52495677f86bc449491826b2b646b743e0cf4 | |
parent | 2f7d4a41904d0bcc54da3462f20a3a2f18f6fc40 (diff) | |
download | samba-04abf2cc8dfda2a969cd2c1257d5d5a41979a0d2.tar.gz samba-04abf2cc8dfda2a969cd2c1257d5d5a41979a0d2.tar.bz2 samba-04abf2cc8dfda2a969cd2c1257d5d5a41979a0d2.zip |
web_server: Avoid references to swat. Load samba.web_server instead.
-rw-r--r-- | source4/scripting/python/samba/web_server/__init__.py (renamed from source4/web_server/swat/__init__.py) | 6 | ||||
-rw-r--r-- | source4/web_server/wsgi.c | 13 |
2 files changed, 11 insertions, 8 deletions
diff --git a/source4/web_server/swat/__init__.py b/source4/scripting/python/samba/web_server/__init__.py index ea28e9422a..b5ac69c96a 100644 --- a/source4/web_server/swat/__init__.py +++ b/source4/scripting/python/samba/web_server/__init__.py @@ -5,17 +5,17 @@ # Copyright © Jelmer Vernooij <jelmer@samba.org> 2008 # # Implementation of SWAT that uses WSGI -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # diff --git a/source4/web_server/wsgi.c b/source4/web_server/wsgi.c index 1c105d0337..2f47af2d25 100644 --- a/source4/web_server/wsgi.c +++ b/source4/web_server/wsgi.c @@ -26,6 +26,7 @@ #include "../lib/util/dlinklist.h" #include "lib/tls/tls.h" #include "lib/tsocket/tsocket.h" +#include "scripting/python/modules.h" /* There's no Py_ssize_t in 2.4, apparently */ #if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5 @@ -380,10 +381,12 @@ static void wsgi_process_http_input(struct web_server_data *wdata, bool wsgi_initialize(struct web_server_data *wdata) { - PyObject *py_swat; + PyObject *py_web_server; Py_Initialize(); + py_update_path("bin"); /* FIXME: Can't assume this is always the case */ + if (PyType_Ready(&web_request_Type) < 0) return false; @@ -394,11 +397,11 @@ bool wsgi_initialize(struct web_server_data *wdata) return false; wdata->http_process_input = wsgi_process_http_input; - py_swat = PyImport_Import(PyString_FromString("swat")); - if (py_swat == NULL) { - DEBUG(0, ("Unable to find SWAT\n")); + py_web_server = PyImport_ImportModule("samba.web_server"); + if (py_web_server == NULL) { + DEBUG(0, ("Unable to find web server\n")); return false; } - wdata->private_data = py_swat; + wdata->private_data = py_web_server; return true; } |