def interact(): app = request.args(0) or 'admin' reset() # process all pending messages in the frontend web_debugger.run() # if debugging, filename and lineno should have valid values filename = web_debugger.filename lineno = web_debugger.lineno if filename: # prevent IOError 2 on some circuntances (EAFP instead of os.access) try: lines = open(filename).readlines() except: lines = "" lines = dict([ (i + 1, l) for (i, l) in enumerate([l.strip("\n").strip("\r") for l in lines]) ]) filename = os.path.basename(filename) else: lines = {} if filename: web_debugger.set_burst(2) env = web_debugger.do_environment() f_locals = env['locals'] f_globals = {} for name, value in env['globals'].items(): if name not in gluon.html.__all__ and \ name not in gluon.validators.__all__ and \ name not in gluon.dal.__all__: f_globals[name] = pydoc.text.repr(value) else: f_locals = {} f_globals = {} response.headers['refresh'] = "3" if web_debugger.exception_info: response.flash = T('"User Exception" debug mode. ' 'An error ticket could be issued!') return dict(app=app, data="", filename=web_debugger.filename, lines=lines, lineno=lineno, f_globals=f_globals, f_locals=f_locals, exception=web_debugger.exception_info)
def interact(): app = request.args(0) or "admin" reset() # process all pending messages in the frontend web_debugger.run() # if debugging, filename and lineno should have valid values filename = web_debugger.filename lineno = web_debugger.lineno if filename: # prevent IOError 2 on some circuntances (EAFP instead of os.access) try: lines = open(filename).readlines() except: lines = "" lines = dict([(i + 1, l) for (i, l) in enumerate([l.strip("\n").strip("\r") for l in lines])]) filename = os.path.basename(filename) else: lines = {} if filename: web_debugger.set_burst(2) env = web_debugger.do_environment() f_locals = env["locals"] f_globals = {} for name, value in env["globals"].items(): if ( name not in gluon.html.__all__ and name not in gluon.validators.__all__ and name not in gluon.dal.__all__ ): f_globals[name] = pydoc.text.repr(value) else: f_locals = {} f_globals = {} response.headers["refresh"] = "3" if web_debugger.exception_info: response.flash = T('"User Exception" debug mode. ' "An error ticket could be issued!") return dict( app=app, data="", filename=web_debugger.filename, lines=lines, lineno=lineno, f_globals=f_globals, f_locals=f_locals, exception=web_debugger.exception_info, )
def interact(): app = request.args(0) or 'admin' reset() # process all pending messages in the frontend web_debugger.run() # if debugging, filename and lineno should have valid values filename = web_debugger.filename lineno = web_debugger.lineno if filename: lines = dict([(i + 1, l) for (i, l) in enumerate( [l.strip("\n").strip("\r") for l in open(filename).readlines()])]) filename = os.path.basename(filename) else: lines = {} if filename: web_debugger.set_burst(2) env = web_debugger.do_environment() f_locals = env['locals'] f_globals = {} for name, value in env['globals'].items(): if name not in gluon.html.__all__ and \ name not in gluon.validators.__all__ and \ name not in gluon.dal.__all__: f_globals[name] = pydoc.text.repr(value) else: f_locals = {} f_globals = {} response.headers['refresh'] = "3" if web_debugger.exception_info: response.flash = T('"User Exception" debug mode. ' 'An error ticket could be issued!') return dict(app=app, data="", filename=web_debugger.filename, lines=lines, lineno=lineno, f_globals=f_globals, f_locals=f_locals, exception=web_debugger.exception_info)