feat: Allow me to execute anything console would allow
This commit is contained in:
parent
d1196a94da
commit
aae0309ced
1 changed files with 5 additions and 1 deletions
|
|
@ -133,6 +133,7 @@ def reset_perms(context):
|
|||
def execute(context, method, args=None, kwargs=None, profile=False):
|
||||
"Execute a function"
|
||||
for site in context.sites:
|
||||
ret = ""
|
||||
try:
|
||||
frappe.init(site=site)
|
||||
frappe.connect()
|
||||
|
|
@ -154,7 +155,10 @@ def execute(context, method, args=None, kwargs=None, profile=False):
|
|||
pr = cProfile.Profile()
|
||||
pr.enable()
|
||||
|
||||
ret = frappe.get_attr(method)(*args, **kwargs)
|
||||
try:
|
||||
ret = frappe.get_attr(method)(*args, **kwargs)
|
||||
except Exception:
|
||||
ret = frappe.safe_eval(method + "()", eval_globals=globals(), eval_locals=locals())
|
||||
|
||||
if profile:
|
||||
pr.disable()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue