Fix the spore 'base_url' attribute

This commit is contained in:
Christophe de Vienne 2012-09-23 16:16:51 +02:00
parent 740cbea766
commit a02b367a90
2 changed files with 4 additions and 4 deletions

View File

@ -205,7 +205,7 @@ class WSRoot(object):
res_content_type = None res_content_type = None
if request.path == self._webpath + '/api.spore': if request.path == self._webpath + '/api.spore':
res.body = spore.getdesc(self) res.body = spore.getdesc(self, request)
res.content_type = 'application/json' res.content_type = 'application/json'
return res return res

View File

@ -6,7 +6,7 @@ except ImportError:
import json import json
def getdesc(root): def getdesc(root, request):
methods = {} methods = {}
for path, funcdef in root.getapi(): for path, funcdef in root.getapi():
@ -33,7 +33,7 @@ def getdesc(root):
methods[name] = { methods[name] = {
'method': method, 'method': method,
'path': '/'.join([root._webpath] + path) 'path': '/'.join(path)
} }
if required_params: if required_params:
methods[name]['required_params'] = required_params methods[name]['required_params'] = required_params
@ -50,7 +50,7 @@ def getdesc(root):
formats.append('json') formats.append('json')
api = { api = {
'base_url': root._webpath, 'base_url': request.host_url + root._webpath,
'version': '0.1', 'version': '0.1',
'name': getattr(root, 'name', 'name'), 'name': getattr(root, 'name', 'name'),
'authority': '', 'authority': '',