lordgamez commented on code in PR #1712: URL: https://github.com/apache/nifi-minifi-cpp/pull/1712#discussion_r1483114670
########## extensions/python/types/PyProcessContext.cpp: ########## @@ -65,12 +66,31 @@ PyObject* PyProcessContext::getProperty(PyProcessContext* self, PyObject* args) return nullptr; } - const char* property; - if (!PyArg_ParseTuple(args, "s", &property)) { + const char* property_name = nullptr; + PyObject* script_flow_file = nullptr; + if (!PyArg_ParseTuple(args, "s|O", &property_name, &script_flow_file)) { throw PyException(); } + std::string value; - context->getProperty(property, value); + if (!script_flow_file) { + if (!context->getProperty(property_name, value)) { + Py_RETURN_NONE; + } + } else { + auto py_flow = reinterpret_cast<PyScriptFlowFile*>(script_flow_file); + const auto flow_file = py_flow->script_flow_file_.lock(); + if (!flow_file) { + PyErr_SetString(PyExc_AttributeError, "tried reading FlowFile outside 'on_trigger'"); + return nullptr; + } Review Comment: Currently the held type of is `std::weak_ptr<core::FlowFile>` in both `PyScriptFlowFile` and `PyScriptFlowFile`, where this is the way the held objects are handled in both files. We can refactor this in the future, but for the time being I think we should stick with using the same handling here as well, or is there anything else you meant by leaving the door open? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org