From 6ed1edf538e94c17d60bab4d443cd8f2feb00e02 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 4 Oct 2013 11:17:31 +0200 Subject: [PATCH] [IMP] turns out PIL provides its own mime mapping... bzr revid: xmo@openerp.com-20131004091731-8r235491f3h2af2q --- addons/website/controllers/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index f7854a90794..10f0a130697 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -34,8 +34,6 @@ def auth_method_public(): http.auth_methods['public'] = auth_method_public NOPE = object() -# PIL images have a type flag, but no MIME. Reverse type flag to MIME. -PIL_MIME_MAPPING = {'PNG': 'image/png', 'JPEG': 'image/jpeg', 'GIF': 'image/gif', } # Completely arbitrary limits MAX_IMAGE_WIDTH, MAX_IMAGE_HEIGHT = IMAGE_LIMITS = (1024, 768) class Website(openerp.addons.web.controllers.main.Home): @@ -327,7 +325,7 @@ class Images(http.Controller): # FIXME: unknown format or not an image image = Image.open(buf) - response.mimetype = PIL_MIME_MAPPING[image.format] + response.mimetype = Image.MIME[image.format] w, h = image.size max_w, max_h = fit