From 0187247899d7ec303264c3daf601b7dd802643e4 Mon Sep 17 00:00:00 2001 From: C Anthony Risinger Date: Wed, 15 Jul 2015 17:04:25 -0500 Subject: [PATCH] load python mule from callable, eg. --mule=package.module:callable --- plugins/python/python_plugin.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 617470a0..943ee721 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -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;