diff options
Diffstat (limited to 'src/jarabe/http.py')
-rw-r--r-- | src/jarabe/http.py | 14 |
1 files changed, 8 insertions, 6 deletions
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)) |