Merge pull request #967 from xtfxme/python-mule-from-callable

load python mule from callable, eg. --mule=package.module:callable
This commit is contained in:
unbit
2015-07-16 01:21:55 +02:00
+14
View File
@@ -1821,6 +1821,20 @@ int uwsgi_python_mule(char *opt) {
UWSGI_RELEASE_GIL;
return 1;
}
else if (strchr(opt, ':')) {
UWSGI_GET_GIL;
PyObject *result = NULL;
PyObject *arglist = Py_BuildValue("()");
PyObject *callable = up.loaders[LOADER_MOUNT](opt);
if (callable) {
result = PyEval_CallObject(callable, arglist);
}
Py_XDECREF(result);
Py_XDECREF(arglist);
Py_XDECREF(callable);
UWSGI_RELEASE_GIL;
return 1;
}
return 0;