image_data = self.placeholder(req)
headers.append(('ETag', retag))
headers.append(('Content-Length', len(image_data)))
+ try:
+ ncache = int(kw.get('cache'))
+ headers.append(('Cache-Control', 'no-cache' if ncache == 0 else 'max-age=%s' % (ncache)))
+ except:
+ pass
return req.make_response(image_data, headers)
def placeholder(self, req):
addons_path = openerpweb.addons_manifest['web']['addons_path']
var email_md5 = $.md5(email);
return 'http://www.gravatar.com/avatar/' + email_md5 + '.png?s=' + size + '&d=' + default_;
},
- kanban_image: function(model, field, id) {
+ kanban_image: function(model, field, id, cache) {
id = id || '';
var url = instance.connection.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + id;
+ if (cache !== undefined) {
+ // Set the cache duration in seconds.
+ url += '&cache=' + parseInt(cache, 10);
+ }
return url;
},
kanban_text_ellipsis: function(s, size) {