Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2013-07-31 03:30:44 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2013-07-31 03:30:44 (GMT)
commit889aa12d618231aa7eebb90d283c69a71f6b2bf4 (patch)
treedfb03c5ebeadb79794d76aeec605e178591ebcfc
parent413daa0ad6c34186291a2d663c60b645cfbaddaf (diff)
Make interactions with local webui more explicit, it is all time API requests
-rw-r--r--TODO2
-rwxr-xr-xsugar-network2
-rwxr-xr-xsugar-network-client13
-rwxr-xr-xsugar-network-node14
4 files changed, 7 insertions, 24 deletions
diff --git a/TODO b/TODO
index d2f2799..7958fa4 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,5 @@
- 0.10
- - s/implementation/version/
+ - i18n searches
- delete outdated impls on PUTing new one
diff --git a/sugar-network b/sugar-network
index 1b7efb3..ac61fa7 100755
--- a/sugar-network
+++ b/sugar-network
@@ -324,7 +324,7 @@ class Application(application.Application):
key = _ESCAPE_VALUE_RE.sub("'\\1'", key)
print eval('result%s' % key)
else:
- print dumps(result, indent=2)
+ print dumps(result, indent=2, ensure_ascii=False)
# Let toolkit.http work in concurrence
diff --git a/sugar-network-client b/sugar-network-client
index 7827ab3..9e3b62d 100755
--- a/sugar-network-client
+++ b/sugar-network-client
@@ -127,17 +127,8 @@ class Application(application.Daemon):
if webui.webui.value:
host = (webui.webui_host.value, webui.webui_port.value)
logging.info('Start Web server on %s:%s', *host)
-
- 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 = client.sugar_uid()
- request.update(kwargs)
- return router.call(request, Response())
-
- webui_app = webui.get_app(webui_call,
+ webui_app = webui.get_app(
+ lambda x: router.call(Request(x), Response()),
'http://localhost:%s' % client.ipc_port.value)
server = coroutine.WSGIServer(host, webui_app)
self.jobs.spawn(server.serve_forever)
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: