def callback():
app = request.args[0]
command = request.vars.statement
escape = command[:1] != '!'
history = session['history:' + app] = session.get(
'history:' + app, gluon.contrib.shell.History())
if not escape:
command = command[1:]
if command == '%reset':
reset()
return '*** reset ***'
elif command[0] == '%':
try:
command = session['commands:' + app][int(command[1:])]
except ValueError:
return ''
session['commands:' + app].append(command)
environ = env(app, True, extra_request=dict(is_https=request.is_https))
output = gluon.contrib.shell.run(history, command, environ)
k = len(session['commands:' + app]) - 1
#output = PRE(output)
#return TABLE(TR('In[%i]:'%k,PRE(command)),TR('Out[%i]:'%k,output))
return cgi.escape('In [%i] : %s%s\n' % (k + 1, command, output))
评论列表
文章目录