Suppose I have a config and the name of a field, such as “isr.datasetType”. What is the best way to get the value of the field? Using getattr
doesn’t work if the item is a subtask:
>>> namespace.config.isr.datasetType
'raw'
>>> getattr(namespace.config, "isr.datasetType")
*** AttributeError: 'ProcessCcdConfig' object has no attribute 'isr.datasetType'
The technique I am using is to walk through one item at a time, but I am wondering if there is a more direct method. Here is an example with no error handling:
keyList = name.split(".")
value = config
for key in keyList:
value = getattr(item, key)