Skip to content

Commit

Permalink
add: func entry to wrap python function as entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanValov committed Sep 1, 2019
1 parent 356d2c0 commit f83deaa
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/ram/wiz/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@
from ram.process import ProcessError


def FuncEntry(function, *args, **kwargs):
pause = kwargs.pop('pause', True)

def __fn_func(function=function, args=args, pause=pause):
try:
return function(*args)
except Exception as e:
print
print "Error at:"
print "\t%s: %s" % ('func', function)
print "\targs: %s" % ' '.join(args)
print
print "\twith: %s" % str(e)
print
if pause:
print "Press ENTER to continue ..."
raw_input()
else:
raise SystemExit(*e.args)

return __fn_func


def UnitEntry(namepath, *args, **kwargs):
input = kwargs.pop('input', True)
apply = kwargs.pop('apply', True)
Expand Down

0 comments on commit f83deaa

Please sign in to comment.