Commits

Matthew Turk committed 30104ba

Some fixes, playing with server instantiation

Comments (0)

Files changed (1)

-from bottle import request, response, route, run, debug
+from bottle import request, response, route, run, server_names, debug
 
 import codeop
 import inspect
 
 from web_widgets import YTWebWidget
 
-class HTTPREPL:
+class HTTPREPL(object):
     
     def __init__(self, locals=None):
         self.locals = {}
         doc = getattr(result, "__doc__", "") or ""
         return "%s(%s)\n%s" % (line, ", ".join(arglist), doc)
     
-    
 route_functions = {}
 repl = HTTPREPL(None)
 
         response.status = 204
     return json.dumps( dict(text = result, new_values = new_values ))
 
-@preroute("/dir", method="POST")
+@preroute("/dir")
 def rdir():
     """Push 'line' and return result of eval on the final expr."""
-    line = request.POST['line']
+    line = request.GET['line']
     result = repl.dir(line)
     if not result:
         response.status = 204
             thread = threading.Timer(0.5, _open_browser)
             thread.start()
         open_browser()
-    run(host='localhost', port=8080)
+    server_type = server_names.get("wsgiref")
+    server = server_type(host='localhost', port=8080)
+    #repl.locals['server'] = server
+    run(server=server)
 
 # from yt.mods import *; pf = load("/Users/matthewturk/Research/data/RD0005-mine/RedshiftOutput0005");proj = pf.h.proj(0,"Density");from yt.visualization.image_panner.api import VariableMeshPanner; vmp = VariableMeshPanner(proj, (512, 512), "Density"); add_image_panner(vmp)
 # from yt.mods import *; pf = load("/Users/matthewturk/Research/data/RD0005-mine/RedshiftOutput0005");proj = pf.h.proj(0,"Density");from yt.visualization.image_panner.api import VariableMeshPanner; vmp = VariableMeshPanner(proj, (512, 512), "Density", add_image); vmp.zoom(1.0)