Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
a couple of fixes, and reintroduction of string-based multiapp
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto@dexter committed Aug 24, 2011
1 parent 7b3514f commit bbde0c8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
22 changes: 21 additions & 1 deletion plugins/python/pyloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,16 @@ int init_uwsgi_app(int loader, void *arg1, struct wsgi_request *wsgi_req, PyThre
wi->mountpoint_len = strlen(wi->mountpoint);
wsgi_req->appid = wi->mountpoint;
wsgi_req->appid_len = wi->mountpoint_len;
#ifdef UWSGI_DEBUG
uwsgi_log("main mountpoint = %s\n", wi->mountpoint);
#endif
wi->callable = PyDict_GetItem(applications, app_mnt);
if (PyString_Check((PyObject *) wi->callable)) {
PyObject *callables_dict = get_uwsgi_pydict((char *)arg1);
if (callables_dict) {
wi->callable = PyDict_GetItem(callables_dict, (PyObject *)wi->callable);
}
}
}

Py_INCREF((PyObject *)wi->callable);
Expand Down Expand Up @@ -329,7 +337,19 @@ int init_uwsgi_app(int loader, void *arg1, struct wsgi_request *wsgi_req, PyThre

wsgi_req->appid = PyString_AsString(app_mnt);
wsgi_req->appid_len = strlen(wsgi_req->appid);
init_uwsgi_app(LOADER_CALLABLE, PyDict_GetItem(applications, app_mnt), wsgi_req, wi->interpreter, app_type);
PyObject *a_callable = PyDict_GetItem(applications, app_mnt);
if (PyString_Check(a_callable)) {

PyObject *callables_dict = get_uwsgi_pydict((char *)arg1);
if (callables_dict) {
a_callable = PyDict_GetItem(callables_dict, a_callable);
}
}
if (!a_callable) {
uwsgi_log("skipping broken app %s\n", wsgi_req->appid);
continue;
}
init_uwsgi_app(LOADER_CALLABLE, a_callable, wsgi_req, wi->interpreter, app_type);
}
}

Expand Down
10 changes: 6 additions & 4 deletions plugins/python/symimporter.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,15 @@ static PyObject* symimporter_load_module(PyObject *self, PyObject *args) {
}

static PyMethodDef symimporter_methods[] = {
{"find_module", symimporter_find_module, METH_VARARGS},
{"load_module", symimporter_load_module, METH_VARARGS},
{"find_module", symimporter_find_module, METH_VARARGS},
{"load_module", symimporter_load_module, METH_VARARGS},
{ NULL, NULL },
};

static PyMethodDef symzipimporter_methods[] = {
{"find_module", symzipimporter_find_module, METH_VARARGS},
{"load_module", symzipimporter_load_module, METH_VARARGS},
{"find_module", symzipimporter_find_module, METH_VARARGS},
{"load_module", symzipimporter_load_module, METH_VARARGS},
{ NULL, NULL },
};

static void uwsgi_symimporter_free(struct _symimporter *self) {
Expand Down
2 changes: 1 addition & 1 deletion protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ int uwsgi_parse_vars(struct wsgi_request *wsgi_req) {
script_name = wsgi_req->var_cnt;
}
for(i=0;i<uwsgi_apps_cnt;i++) {
//uwsgi_log("app mountpoint = %.*s\n", uwsgi.apps[i].mountpoint_len, uwsgi.apps[i].mountpoint);
//uwsgi_log("app mountpoint = %.*s\n", uwsgi_apps[i].mountpoint_len, uwsgi_apps[i].mountpoint);
if (orig_path_info_len >= uwsgi_apps[i].mountpoint_len) {
if (!uwsgi_startswith(orig_path_info, uwsgi_apps[i].mountpoint, uwsgi_apps[i].mountpoint_len) && uwsgi_apps[i].mountpoint_len > best_found) {
best_found = uwsgi_apps[i].mountpoint_len;
Expand Down

0 comments on commit bbde0c8

Please sign in to comment.