1 #include <lib/base/nconfig.h>
2 #include <lib/python/python.h>
4 ePyObject ePythonConfigQuery::m_queryFunc;
6 void ePythonConfigQuery::setQueryFunc(ePyObject queryFunc)
9 Py_DECREF(m_queryFunc);
10 m_queryFunc = queryFunc;
12 Py_INCREF(m_queryFunc);
15 RESULT ePythonConfigQuery::getConfigValue(const char *key, std::string &value)
17 if (key && PyCallable_Check(m_queryFunc))
19 ePyObject pArgs = PyTuple_New(1);
20 PyTuple_SET_ITEM(pArgs, 0, PyString_FromString(key));
21 ePyObject pRet = PyObject_CallObject(m_queryFunc, pArgs);
25 if (PyString_Check(pRet))
27 value.assign(PyString_AS_STRING(pRet));