2 Unix SMB/CIFS implementation.
3 Samba utility functions
4 Copyright © Jelmer Vernooij <jelmer@samba.org> 2008
6 Implementation of the WSGI interface described in PEP0333
7 (http://www.python.org/dev/peps/pep-0333)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 static PyObject *start_response(PyObject *args, PyObject *kwargs)
28 PyObject *response_header, *exc_info;
30 const char *kwnames[] = {
31 "status", "response_header", "exc_info", NULL
34 if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *)"sOO:start_response", (char **)kwnames, &status, &response_header, &exc_info)) {
38 /* FIXME: response_header, exc_info */
40 /* FIXME: Wrap stdout */
44 static PyObject *create_environ(void)
46 PyObject *env, *osmodule, *osenviron;
48 osmodule = PyImport_ImportModule("os");
52 osenviron = PyObject_CallMethod(osmodule, "environ", NULL);
54 env = PyDict_Copy(osenviron);
56 PyDict_SetItemString(env, "wsgi.input", NULL); /* FIXME */
57 PyDict_SetItemString(env, "wsgi.errors", NULL); /* FIXME */
58 PyDict_SetItemString(env, "wsgi.version", Py_BuildValue("(i,i)", 1, 0));
59 PyDict_SetItemString(env, "wsgi.multithread", Py_False);
60 PyDict_SetItemString(env, "wsgi.multiprocess", Py_True);
61 PyDict_SetItemString(env, "wsgi.run_once", Py_False);
64 PyDict_SetItemString(env, "wsgi.url_scheme", "http");
65 PyDict_SetItemString(env, "wsgi.url_scheme", "https");