diff options
author | Aleksey Lim <alsroot@sugarlabs.org> | 2013-07-31 03:30:44 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@sugarlabs.org> | 2013-07-31 03:30:44 (GMT) |
commit | 889aa12d618231aa7eebb90d283c69a71f6b2bf4 (patch) | |
tree | dfb03c5ebeadb79794d76aeec605e178591ebcfc /sugar-network-node | |
parent | 413daa0ad6c34186291a2d663c60b645cfbaddaf (diff) |
Make interactions with local webui more explicit, it is all time API requests
Diffstat (limited to 'sugar-network-node')
-rwxr-xr-x | sugar-network-node | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/sugar-network-node b/sugar-network-node index 905dec5..3ef2f4c 100755 --- a/sugar-network-node +++ b/sugar-network-node @@ -87,20 +87,12 @@ class Application(application.Daemon): client_routes = ClientRoutes(home, api_url='http://localhost:%s' % node.port.value) client_app = Router(client_routes) - - def webui_call(method, path=None, cmd=None, - content_type=None, content=None, **kwargs): - request = Request(method=method, path=path, cmd=cmd) - request.content_type = content_type or 'application/json' - request.content = content - request.principal = 'demo' - request.update(kwargs) - return client_app.call(request, Response()) - host = (node.host.value, webui.webui_port.value) logging.info('Start Web server on %s:%s port', *host) server = coroutine.WSGIServer(host, - webui.get_app(webui_call, client.api_url.value, True)) + webui.get_app( + lambda x: client_app.call(Request(x), Response()), + client.api_url.value, True)) self.jobs.spawn(server.serve_forever) try: |