| 790 | } |
| 791 | |
| 792 | PyObject* DocumentPy::getObject(PyObject* args) |
| 793 | { |
| 794 | DocumentObject* obj = nullptr; |
| 795 | |
| 796 | do { |
| 797 | char* name = nullptr; |
| 798 | if (PyArg_ParseTuple(args, "s", &name)) { |
| 799 | obj = getDocumentPtr()->getObject(name); |
| 800 | break; |
| 801 | } |
| 802 | |
| 803 | PyErr_Clear(); |
| 804 | long id = -1; |
| 805 | if (PyArg_ParseTuple(args, "l", &id)) { |
| 806 | obj = getDocumentPtr()->getObjectByID(id); |
| 807 | break; |
| 808 | } |
| 809 | |
| 810 | PyErr_SetString(PyExc_TypeError, "a string or integer is required"); |
| 811 | return nullptr; |
| 812 | } while (false); |
| 813 | |
| 814 | if (obj) { |
| 815 | return obj->getPyObject(); |
| 816 | } |
| 817 | |
| 818 | Py_Return; |
| 819 | } |
| 820 | |
| 821 | PyObject* DocumentPy::getObjectsByLabel(PyObject* args) |
| 822 | { |
no test coverage detected