! Calls the execute() method of the Python feature class. If the Python feature class doesn't have an execute() method or if it returns False this method also return false and true otherwise. */
| 72 | execute() method or if it returns False this method also return false and true otherwise. |
| 73 | */ |
| 74 | bool FeaturePythonImp::execute() |
| 75 | { |
| 76 | FC_PY_CALL_CHECK(execute) |
| 77 | Base::PyGILStateLocker lock; |
| 78 | try { |
| 79 | if (has__object__) { |
| 80 | Py::Object res = Base::pyCall(py_execute.ptr()); |
| 81 | if (res.isBoolean() && !res.isTrue()) { |
| 82 | return false; |
| 83 | } |
| 84 | return true; |
| 85 | } |
| 86 | else { |
| 87 | Py::Tuple args(1); |
| 88 | args.setItem(0, Py::Object(object->getPyObject(), true)); |
| 89 | Py::Object res = Base::pyCall(py_execute.ptr(), args.ptr()); |
| 90 | if (res.isBoolean() && !res.isTrue()) { |
| 91 | return false; |
| 92 | } |
| 93 | return true; |
| 94 | } |
| 95 | } |
| 96 | catch (Py::Exception&) { |
| 97 | if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) { |
| 98 | PyErr_Clear(); |
| 99 | return false; |
| 100 | } |
| 101 | Base::PyException::throwException(); // extract the Python error text |
| 102 | } |
| 103 | |
| 104 | return false; |
| 105 | } |
| 106 | |
| 107 | bool FeaturePythonImp::mustExecute() const |
| 108 | { |
nothing calls this directly
no test coverage detected