From: Michael Tremer Date: Thu, 20 Mar 2014 18:40:36 +0000 (+0100) Subject: i-use: Fix sending error images. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=30bb04e266c30f7d6a7d5529a965b88ec0b24008;p=ipfire.org.git i-use: Fix sending error images. The error handling has changed in a recent version of Tornado and our code has not been adapted accordingly. --- diff --git a/webapp/handlers_iuse.py b/webapp/handlers_iuse.py index 4428afd8..13085c98 100644 --- a/webapp/handlers_iuse.py +++ b/webapp/handlers_iuse.py @@ -9,7 +9,7 @@ from handlers_base import * import backend class IUseImage(BaseHandler): - def get_error_html(self, status_code, **kwargs): + def write_error(self, status_code, **kwargs): """ Select a random image from the errors directory and return the content. @@ -24,8 +24,11 @@ class IUseImage(BaseHandler): image = random.choice(images) image = os.path.join(template_path, image) + imgdata = None with open(image, "rb") as f: - return f.read() + imgdata = f.read() + + self.finish(imgdata) def get(self, profile_id, image_id): image = None