From a02b367a90519ed8c70a09d1606c09e1496a182e Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Sun, 23 Sep 2012 16:16:51 +0200 Subject: [PATCH] Fix the spore 'base_url' attribute --- wsme/root.py | 2 +- wsme/spore.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wsme/root.py b/wsme/root.py index b0d9d2f..91a0106 100644 --- a/wsme/root.py +++ b/wsme/root.py @@ -205,7 +205,7 @@ class WSRoot(object): res_content_type = None if request.path == self._webpath + '/api.spore': - res.body = spore.getdesc(self) + res.body = spore.getdesc(self, request) res.content_type = 'application/json' return res diff --git a/wsme/spore.py b/wsme/spore.py index b45554c..e481bf6 100644 --- a/wsme/spore.py +++ b/wsme/spore.py @@ -6,7 +6,7 @@ except ImportError: import json -def getdesc(root): +def getdesc(root, request): methods = {} for path, funcdef in root.getapi(): @@ -33,7 +33,7 @@ def getdesc(root): methods[name] = { 'method': method, - 'path': '/'.join([root._webpath] + path) + 'path': '/'.join(path) } if required_params: methods[name]['required_params'] = required_params @@ -50,7 +50,7 @@ def getdesc(root): formats.append('json') api = { - 'base_url': root._webpath, + 'base_url': request.host_url + root._webpath, 'version': '0.1', 'name': getattr(root, 'name', 'name'), 'authority': '',