From 0ae8b5429b38b84eb484e1bd62ed653e2be93523 Mon Sep 17 00:00:00 2001 From: echel0n Date: Wed, 18 Jun 2014 10:06:06 -0700 Subject: [PATCH] WebAPI showPosters fixed! --- sickbeard/webapi.py | 7 ++++--- sickbeard/webserve.py | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sickbeard/webapi.py b/sickbeard/webapi.py index 64a969db..c149cd99 100644 --- a/sickbeard/webapi.py +++ b/sickbeard/webapi.py @@ -296,10 +296,11 @@ def filter_params(cmd, args, kwargs): return curArgs, curKwargs -class ApiCall(Api): +class ApiCall(webserve.IndexHandler): _help = {"desc": "No help message available. Please tell the devs that a help msg is missing for this cmd"} def __init__(self, args, kwargs): + # missing try: if self._missing: @@ -2103,7 +2104,7 @@ class CMD_ShowGetPoster(ApiCall): def run(self): """ get the poster for a show in sickbeard """ - return {'outputType': 'image', 'image': webserve.IndexHandler(self.application, self.request).showPoster(self.indexerid, 'poster')} + return {'outputType': 'image', 'image': self.showPoster(self.indexerid, 'poster')} class CMD_ShowGetBanner(ApiCall): @@ -2121,7 +2122,7 @@ class CMD_ShowGetBanner(ApiCall): def run(self): """ get the banner for a show in sickbeard """ - return {'outputType': 'image', 'image': webserve.IndexHandler(self.application, self.request).showPoster(self.indexerid, 'banner')} + return {'outputType': 'image', 'image': self.showPoster(self.indexerid, 'banner')} class CMD_ShowPause(ApiCall): diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 1dd5adc1..9ce0da01 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -223,9 +223,12 @@ class IndexHandler(RequestHandler): response = yield gen.Task(self.getresponse, self._dispatch) self.finish(response) + @asynchronous + @gen.engine def post(self, *args, **kwargs): - return self._dispatch() - + response = yield gen.Task(self.getresponse, self._dispatch) + self.finish(response) + def getresponse(self, func, callback): response = func() callback(response)