Document.openTransaction() now accepts unicode

This commit is contained in:
Yorik van Havre 2016-03-22 12:20:58 -03:00
parent ff0839184b
commit 9e75213c92

View File

@ -319,10 +319,18 @@ PyObject* DocumentPy::moveObject(PyObject *args)
PyObject* DocumentPy::openTransaction(PyObject *args)
{
PyObject *value;
if (!PyArg_ParseTuple(args, "|O",&value))
return NULL; // NULL triggers exception
char *pstr=0;
if (!PyArg_ParseTuple(args, "|s", &pstr)) // convert args: Python->C
return NULL; // NULL triggers exception
if (PyUnicode_Check(value)) {
PyObject* unicode = PyUnicode_AsLatin1String(value);
pstr = PyString_AsString(unicode);
Py_DECREF(unicode);
}
else if (PyString_Check(value)) {
pstr = PyString_AsString(value);
}
getDocumentPtr()->openTransaction(pstr);
Py_Return;
}