lordgamez commented on code in PR #2114:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2114#discussion_r2846028623
##########
extensions/python/pythonprocessors/nifiapi/properties.py:
##########
@@ -267,7 +267,11 @@ def evaluateAttributeExpressions(self, flow_file: FlowFile
= None):
return self
new_string_value = None
- if self.is_dynamic:
+ if flow_file is None and self.is_dynamic:
+ new_string_value = self.cpp_context.getDynamicProperty(self.name)
+ elif flow_file is None:
+ new_string_value = self.cpp_context.getProperty(self.name)
+ elif self.is_dynamic:
new_string_value = self.cpp_context.getDynamicProperty(self.name,
flow_file.cpp_flow_file)
else:
new_string_value = self.cpp_context.getProperty(self.name,
flow_file.cpp_flow_file)
Review Comment:
I think this would be more readable:
```
if flow_file is None:
if self.is_dynamic:
new_string_value = self.cpp_context.getDynamicProperty(self.name)
else:
new_string_value = self.cpp_context.getProperty(self.name)
else:
if self.is_dynamic:
new_string_value = self.cpp_context.getDynamicProperty(self.name,
flow_file.cpp_flow_file)
else:
new_string_value = self.cpp_context.getProperty(self.name,
flow_file.cpp_flow_file)
```
or maybe even better a shorter version:
```
if self.is_dynamic:
getter = self.cpp_context.getDynamicProperty
else:
getter = self.cpp_context.getProperty
args = () if flow_file is None else (flow_file.cpp_flow_file,)
new_string_value = getter(self.name, *args)
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]