[FIX] website controller, correctly resolve last merge about images
authorAntony Lesuisse <al@openerp.com>
Thu, 1 May 2014 16:50:04 +0000 (18:50 +0200)
committerAntony Lesuisse <al@openerp.com>
Thu, 1 May 2014 16:50:04 +0000 (18:50 +0200)
fix fp commit to use debian compatible werkzeug api data instead of set_data

bzr revid: al@openerp.com-20140501165004-0e6xp8e9hdpifofj

addons/website/controllers/main.py

index f5dee71..4a0ec5f 100644 (file)
@@ -331,16 +331,13 @@ class Website(openerp.addons.web.controllers.main.Home):
         """ Fetches the requested field and ensures it does not go above
         (max_width, max_height), resizing it if necessary.
 
-        Resizing is bypassed if the object provides a $field_big, which will
-        be interpreted as a pre-resized version of the base field.
-
         If the record is not found or does not have the requested field,
         returns a placeholder image via :meth:`~.placeholder`.
 
         Sets and checks conditional response parameters:
         * :mailheader:`ETag` is always set (and checked)
         * :mailheader:`Last-Modified is set iif the record has a concurrency
-          field (``__last_update``)
+          field (``write_date``)
 
         The requested field is assumed to be base64-encoded image data in
         all cases.
@@ -379,19 +376,12 @@ class Website(openerp.addons.web.controllers.main.Home):
 
         data = record[field].decode('base64')
         if (not max_width) and (not max_height):
-            response.set_data(data)
+            response.data = data
             return response
 
         image = Image.open(cStringIO.StringIO(data))
         response.mimetype = Image.MIME[image.format]
 
-        # record provides a pre-resized version of the base field, use that
-        # directly
-        if record.get(presized):
-            response.data = data
-            return response
-
-        fit = int(max_width), int(max_height)
         w, h = image.size
         max_w, max_h = int(max_width), int(max_height)
         if w < max_w and h < max_h: