Cleanup: use context.path_resolve instead of eval(..)
This commit is contained in:
parent
7bb8eeb3a8
commit
2e9e2715ef
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user