Skip to content

Commit

Permalink
Document.openTransaction() now accepts unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Mar 22, 2016
1 parent ff08391 commit 9e75213
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/App/DocumentPyImp.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit 9e75213

Please sign in to comment.