<%! from kaithem.src.util import url from kaithem.src import pages,unitsofmeasure,util,widgets,kaithemobj import json,re,quart %> <%include file="/pageheader.html"/> Object Inspector <% result = '' %> <% if "cmd" in kwargs: if not quart.request.method=="POST": raise RuntimeError("/errors/wrongmethod") if re.match('([a-zA-Z_][a-zA-Z0-9_]* *=[^=])|(import )|(del )',kwargs['cmd']): exec(kwargs['cmd'], {"kaithem":kaithemobj.kaithem},obj.__dict__) else: result =eval(kwargs['cmd'], {"kaithem":kaithemobj.kaithem},obj.__dict__) %>

Inspecting ${objname|h}

This shows all attributes of the selected object and allows you to run commands in the namespace of the selected object.

%for i in obj.__dict__:

${util.saferepr(obj.__dict__[i])|h}
%endfor

Command Interpreter

You can enter single line commands here. Commands execute in the scope of the object's __dict__, so obj.cheese here would just be cheese. the kaithem object is available as kaithem as usual. You can call functions and get the result, and you can set and delete values. multiline code doesn't work however. Be careful when refreshing this page as it may resend. Using this will add a __builtins__ to the module object.

%if "cmd" in kwargs: %if not quart.request.method=="POST": <% raise quart.redirect("/errors/wrongmethod") %> %endif You Entered:

${kwargs['cmd']}
Result: %if re.match('([a-zA-Z_][a-zA-Z0-9_]* *=[^=])|(import )|(del )',kwargs['cmd']):
Command Run
%else:
${result|h}
%endif %endif
<%include file="/pagefooter.html"/>