Skip to content
Permalink
Browse files

changes from seb review

  • Loading branch information...
alexkuhn committed Apr 15, 2019
1 parent 4d68faa commit 90769088897f4310f7c9e6adbf98516101716f22
Showing with 7 additions and 24 deletions.
  1. +7 −24 addons/web/controllers/main.py
@@ -1003,25 +1003,11 @@ def content_common(self, xmlid=None, model='ir.attachment', id=None, field='data
response.set_cookie('fileToken', token)
return response

@http.route(['/web/image',
'/web/user_image/<string:xmlid>',
'/web/user_image/<string:xmlid>/<string:filename>',
'/web/user_image/<string:xmlid>/<int:width>x<int:height>',
'/web/user_image/<string:xmlid>/<int:width>x<int:height>/<string:filename>',
'/web/user_image/<string:model>/<int:id>/<string:field>',
'/web/user_image/<string:model>/<int:id>/<string:field>/<string:filename>',
'/web/user_image/<string:model>/<int:id>/<string:field>/<int:width>x<int:height>',
'/web/user_image/<string:model>/<int:id>/<string:field>/<int:width>x<int:height>/<string:filename>',
'/web/user_image/<int:id>',
'/web/user_image/<int:id>/<string:filename>',
'/web/user_image/<int:id>/<int:width>x<int:height>',
'/web/user_image/<int:id>/<int:width>x<int:height>/<string:filename>',
'/web/user_image/<int:id>-<string:unique>',
'/web/user_image/<int:id>-<string:unique>/<string:filename>',
'/web/user_image/<int:id>-<string:unique>/<int:width>x<int:height>',
'/web/user_image/<int:id>-<string:unique>/<int:width>x<int:height>/<string:filename>'], type='http', auth="public")
def content_image_user(self, **kw):
return self.content_image_core(**kw, placeholder='user_placeholder.jpg')
@http.route(['/web/partner_image',
'/web/partner_image/<string:model>/<int:id>/<string:field>'], type='http', auth="public")
def content_image_partner(self, *args, **kwargs):
kwargs.pop('placeholder');
return self.content_image(placeholder='user_placeholder.jpg', *args, **kwargs)

@http.route(['/web/image',
'/web/image/<string:xmlid>',
@@ -1040,13 +1026,10 @@ def content_image_user(self, **kw):
'/web/image/<int:id>-<string:unique>/<string:filename>',
'/web/image/<int:id>-<string:unique>/<int:width>x<int:height>',
'/web/image/<int:id>-<string:unique>/<int:width>x<int:height>/<string:filename>'], type='http', auth="public")
def content_image(self, **kw):
return self.content_image_core(**kw, placeholder='placeholder.png')

def content_image_core(self, placeholder, xmlid=None, model='ir.attachment', id=None, field='datas',
def content_image(self, xmlid=None, model='ir.attachment', id=None, field='datas',
filename_field='datas_fname', unique=None, filename=None, mimetype=None,
download=None, width=0, height=0, crop=False, access_token=None, avoid_if_small=False,
upper_limit=False, **kw):
upper_limit=False, placeholder='placeholder.png', **kwargs):
status, headers, content = request.env['ir.http'].binary_content(
xmlid=xmlid, model=model, id=id, field=field, unique=unique, filename=filename,
filename_field=filename_field, download=download, mimetype=mimetype,

0 comments on commit 9076908

Please sign in to comment.
You can’t perform that action at this time.