From a2a3f46d7281217d5958ffdaceab0f290b0065d1 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 24 Oct 2013 15:57:30 +0200 Subject: [PATCH] [FIX] 'inline' set_image_data bzr revid: xmo@openerp.com-20131024135730-321532upt3aq5esw --- addons/website/controllers/main.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 64357e1a443..69da43a3549 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -327,21 +327,14 @@ class Images(http.Controller): if response.status_code == 304: return response - return self.set_image_data( - response, record[field].decode('base64'), - fit=(int(max_width), int(max_height))) + data = record[field].decode('base64') + fit = int(max_width), int(max_height) - def set_image_data(self, response, data, fit=(maxint, maxint)): - """ Sets an inferred mime type on the response object, and puts the - provided image's data in it, possibly after resizing if requested - - Returns the response object after setting its mime and content, so - the result of ``get_final_image`` can be returned directly. - """ buf = cStringIO.StringIO(data) # FIXME: unknown format or not an image image = Image.open(buf) + image.load() response.mimetype = Image.MIME[image.format] w, h = image.size