Cleanup: use context.path_resolve instead of eval(..)

This commit is contained in:
Campbell Barton 2022-04-06 11:42:46 +10:00
parent 7bb8eeb3a8
commit 2e9e2715ef
2 changed files with 4 additions and 8 deletions

View File

@ -43,7 +43,7 @@ def rna_idprop_context_value(context, context_member, property_type):
rna_item = pin_id
context_member = "space_data.pin_id"
else:
rna_item = eval("context." + context_member)
rna_item = context.path_resolve(context_member)
return rna_item, context_member

View File

@ -345,14 +345,10 @@ def xml2rna(
def _get_context_val(context, path):
path_full = "context." + path
try:
value = eval(path_full)
except:
import traceback
traceback.print_exc()
print("Error: %r could not be found" % path_full)
value = context.path_resolve(path)
except Exception as ex:
print("Error: %r, path %r not found" % (ex, path))
value = Ellipsis
return value