diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-01-24 13:44:26 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-01-24 13:44:26 (GMT) |
commit | ade030943fa516eaac6df40021f4a7b15c74728a (patch) | |
tree | bc78f001966e401d0d84e2051e07e84395d42f23 | |
parent | 095746b83f8d4d7ef77cee01b6e62b34c9f90343 (diff) |
Server html toolkit files
-rw-r--r-- | src/jarabe/config.py.in | 1 | ||||
-rw-r--r-- | src/jarabe/http.py | 14 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/jarabe/config.py.in b/src/jarabe/config.py.in index f2a66a2..e1f305d 100644 --- a/src/jarabe/config.py.in +++ b/src/jarabe/config.py.in @@ -19,5 +19,6 @@ data_path = '@prefix@/share/sugar/data' locale_path = '@prefix@/share/locale' ext_path = '@prefix@/share/sugar/extensions' +html_toolkit_path = '@prefix@/share/sugar-toolkit-html' version = '@SUCROSE_VERSION@' diff --git a/src/jarabe/http.py b/src/jarabe/http.py index 3964236..518efa4 100644 --- a/src/jarabe/http.py +++ b/src/jarabe/http.py @@ -4,17 +4,19 @@ import BaseHTTPServer import os from jarabe.model import bundleregistry +from jarabe import config class HTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): splitted = self.path.split("/") - bundle_id = splitted[1] - path = splitted[2:] + if splitted[1] == "toolkit": + base_path = config.html_toolkit_path + else: + registry = bundleregistry.get_registry() + bundle = registry.get_bundle(splitted[1]) + base_path = bundle.get_path() - registry = bundleregistry.get_registry() - bundle = registry.get_bundle(bundle_id) - - file_path = os.path.join(bundle.get_path(), *path) + file_path = os.path.join(base_path, *splitted[2:]) with open(file_path) as f: self.send_response(200) self.send_header('Content-type', mimetypes.guess_type(file_path)) |