| 49 | } |
| 50 | |
| 51 | PyObject* PropertyContainerPy::getPropertyByName(PyObject* args) |
| 52 | { |
| 53 | char* pstr {}; |
| 54 | int checkOwner = 0; |
| 55 | if (!PyArg_ParseTuple(args, "s|i", &pstr, &checkOwner)) { |
| 56 | return nullptr; |
| 57 | } |
| 58 | |
| 59 | if (checkOwner < 0 || checkOwner > 2) { |
| 60 | PyErr_SetString(PyExc_ValueError, "'checkOwner' expected in the range [0, 2]"); |
| 61 | return nullptr; |
| 62 | } |
| 63 | |
| 64 | App::Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr); |
| 65 | if (!prop) { |
| 66 | PyErr_Format(Base::PyExc_FC_PropertyError, "Property container has no property '%s'", pstr); |
| 67 | return nullptr; |
| 68 | } |
| 69 | |
| 70 | if (!checkOwner || (checkOwner == 1 && prop->getContainer() == getPropertyContainerPtr())) { |
| 71 | return prop->getPyObject(); |
| 72 | } |
| 73 | |
| 74 | Py::TupleN res(Py::asObject(prop->getContainer()->getPyObject()), |
| 75 | Py::asObject(prop->getPyObject())); |
| 76 | |
| 77 | return Py::new_reference_to(res); |
| 78 | } |
| 79 | |
| 80 | PyObject* PropertyContainerPy::getPropertyTouchList(PyObject* args) |
| 81 | { |
no test coverage detected