diff options
| author | Olivier Dony <odo@openerp.com> | 2015-12-09 13:37:43 +0100 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2015-12-09 13:45:00 +0100 |
| commit | 895536380894e27d397fa8e6de43baf0f3dcfded (patch) | |
| tree | b66be2c792d0f11ef2352ab33d59069bc4260343 /addons/web/controllers | |
| parent | 96d316fdf47a175c88eaa8cb9a2df1118c67eb27 (diff) | |
[FIX] web: /web/image - backwards-compatibility
The QWeb image widget allows passing either
max_width, max_height or both, but the
controller required both.
We'll consider a 0px dimension request as
meaning: "appropriate value according to ratio".
Diffstat (limited to 'addons/web/controllers')
| -rw-r--r-- | addons/web/controllers/main.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 8de78aebc2f..290e89e14e3 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1104,13 +1104,13 @@ class Binary(http.Controller): elif status != 200 and download: return request.not_found() - if content and width and height: + if content and (width or height): # resize maximum 500*500 if width > 500: width = 500 if height > 500: height = 500 - content = openerp.tools.image_resize_image(base64_source=content, size=(width, height), encoding='base64', filetype='PNG') + content = openerp.tools.image_resize_image(base64_source=content, size=(width or None, height or None), encoding='base64', filetype='PNG') image_base64 = content and base64.b64decode(content) or self.placeholder() headers.append(('Content-Length', len(image_base64))) |
