[FIX] website: add /website/image compatibility routes
This commit is contained in:
@@ -13,8 +13,7 @@ import werkzeug.wrappers
|
||||
|
||||
import openerp
|
||||
from openerp.addons.base.ir.ir_qweb import AssetsBundle
|
||||
from openerp.addons.web.controllers.main import WebClient
|
||||
from openerp.addons.web_editor.controllers.main import Web_Editor
|
||||
from openerp.addons.web.controllers.main import WebClient, Binary
|
||||
from openerp.addons.web import http
|
||||
from openerp.http import request
|
||||
|
||||
@@ -374,3 +373,29 @@ class Website(openerp.addons.web.controllers.main.Home):
|
||||
if res:
|
||||
return res
|
||||
return request.redirect('/')
|
||||
|
||||
|
||||
#------------------------------------------------------
|
||||
# Retrocompatibility routes
|
||||
#------------------------------------------------------
|
||||
class WebsiteBinary(openerp.http.Controller):
|
||||
@http.route([
|
||||
'/website/image',
|
||||
'/website/image/<xmlid>',
|
||||
'/website/image/<xmlid>/<int:width>x<int:height>',
|
||||
'/website/image/<xmlid>/<field>',
|
||||
'/website/image/<xmlid>/<field>/<int:width>x<int:height>',
|
||||
'/website/image/<model>/<id>/<field>',
|
||||
'/website/image/<model>/<id>/<field>/<int:width>x<int:height>'
|
||||
], type='http', auth="public", website=False, multilang=False)
|
||||
def content_image(self, id=None, max_width=0, max_height=0, **kw):
|
||||
if max_width:
|
||||
kw['width'] = max_width
|
||||
if max_height:
|
||||
kw['height'] = max_height
|
||||
if id:
|
||||
id, _, unique = id.partition('_')
|
||||
kw['id'] = int(id)
|
||||
if unique:
|
||||
kw['unique'] = unique
|
||||
return Binary().content_image(**kw)
|
||||
|
||||
@@ -125,6 +125,8 @@ DEFAULT_CDN_FILTERS = [
|
||||
"^/web/(css|js)/",
|
||||
"^/web/image",
|
||||
"^/web/content",
|
||||
# retrocompatibility
|
||||
"^/website/image/",
|
||||
]
|
||||
|
||||
def unslug(s):
|
||||
|
||||
Reference in New Issue
Block a user