Fixed Web API to work with new tornado code!

This commit is contained in:
echel0n 2014-06-15 23:19:14 -07:00
parent 500f387bad
commit 088e32b117
2 changed files with 6 additions and 1 deletions

View File

@ -177,7 +177,12 @@ class IndexHandler(RedirectHandler):
"""
args = None
path = self.request.uri.split('?')[0]
method = path.strip('/').split('/')[-1]
if path.startswith('/api'):
apikey = path.strip('/').split('/')[-1]
method = path.strip('/').split('/')[0]
self.request.arguments.update({'apikey':[apikey]})
def pred(c):
return inspect.isclass(c) and c.__module__ == pred.__module__

View File

@ -107,7 +107,7 @@ def initWebServer(options={}):
app.add_handlers(".*$", [
(r"/", RedirectHandler, {'url': '/home/'}),
(r'/login', webserve.LoginHandler),
(r'/api', webapi.Api),
(r'/api/(.*)(/?)', webapi.Api),
(r'%s(.*)(/?)' % options['web_root'], webserve.IndexHandler)
])