Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Silva <sebastian@somosazucar.org>2013-05-24 03:41:42 (GMT)
committer Sebastian Silva <sebastian@somosazucar.org>2013-05-24 03:41:42 (GMT)
commitcc3057d0c31b2e7a151bd451c48ed9fec121b7a8 (patch)
tree1c203de64e055f4cdeec23b8cae17e0aea272214
parent9d81661c6f1c98de7595007c24fe24726f88ee66 (diff)
alsroot's patches for working web instance with HTTP API
-rw-r--r--sugar_network_webui/__init__.py5
-rw-r--r--sugar_network_webui/app.py4
-rw-r--r--sugar_network_webui/client.py8
-rw-r--r--sweets.recipe2
4 files changed, 8 insertions, 11 deletions
diff --git a/sugar_network_webui/__init__.py b/sugar_network_webui/__init__.py
index b18e951..44ce039 100644
--- a/sugar_network_webui/__init__.py
+++ b/sugar_network_webui/__init__.py
@@ -16,13 +16,14 @@
from .env import webui, webui_host, webui_port
-def get_app(commands_processor, api_url):
+def get_app(commands_processor, api_url, anonymous=False):
from . import client
client.commands_processor = commands_processor
+ client.anonymous = anonymous
client.api_url = api_url
from . import cursors
# XXX
- if commands_processor._offline:
+ if anonymous:
cursors.home_mount = cursors.network_mount
from .app import app
return app
diff --git a/sugar_network_webui/app.py b/sugar_network_webui/app.py
index c464dfa..1b07af6 100644
--- a/sugar_network_webui/app.py
+++ b/sugar_network_webui/app.py
@@ -98,8 +98,8 @@ def timedelta(mtime):
def get_colors():
- from .client import commands_processor
- if commands_processor._offline:
+ from . import client
+ if client.anonymous:
return ('#000000', '#000000')
try:
diff --git a/sugar_network_webui/client.py b/sugar_network_webui/client.py
index 0de8311..57c4109 100644
--- a/sugar_network_webui/client.py
+++ b/sugar_network_webui/client.py
@@ -20,6 +20,7 @@ from sugar_network.toolkit import coroutine
commands_processor = None
+anonymous = False
api_url = None
_logger = logging.getLogger('sugar_network')
@@ -48,11 +49,6 @@ class Client(object):
return commands_processor.call(request)
@classmethod
- def publish(cls, event, **kwargs):
- kwargs['event'] = event
- commands_processor.publish(kwargs)
-
- @classmethod
def connect(cls, callback, **condition):
cls._subscriptions[callback] = condition
if cls._pull is None:
@@ -82,7 +78,7 @@ class Client(object):
@property
def inline(self):
- return self.call('GET', 'inline') or commands_processor._offline
+ return self.call('GET', 'inline') or anonymous
def launch(self, context, command='activity', object_id=None, uri=None,
args=None):
diff --git a/sweets.recipe b/sweets.recipe
index 0e87b9b..1879d59 100644
--- a/sweets.recipe
+++ b/sweets.recipe
@@ -11,7 +11,7 @@ homepage = http://wiki.sugarlabs.org/go/Platform_Team/Sugar_Network/Browser
version = 0.9
stability = developer
-requires = flask; flask-babel
+requires = flask; flask-babel; flask-classy
[Build]
install = install -m 0755 -d %(DESTDIR)s/%(PYTHONSITEDIR)s &&