[FIX] ir.qweb: consider empty cached bundle as a cache miss
Sometimes a cached bundled could be missing in the ir.attachment filestore (for example after copying a database for test purposes without duplicating the filestore as well). When this happens ir.attachment will return an empty file contents ; treat this as a cache miss. This means empty bundles would not be cached, which is not a big issue - there is little benefit in caching them, and they should not be common nor useful.
This commit is contained in:
parent
a03dfefda9
commit
491162e653
|
@ -1144,7 +1144,7 @@ class AssetsBundle(object):
|
||||||
content = None
|
content = None
|
||||||
domain = [('url', '=', '/web/%s/%s/%s' % (type, self.xmlid, self.version))]
|
domain = [('url', '=', '/web/%s/%s/%s' % (type, self.xmlid, self.version))]
|
||||||
bundle = self.registry['ir.attachment'].search_read(self.cr, self.uid, domain, ['datas'], context=self.context)
|
bundle = self.registry['ir.attachment'].search_read(self.cr, self.uid, domain, ['datas'], context=self.context)
|
||||||
if bundle:
|
if bundle and bundle[0]['datas']:
|
||||||
content = bundle[0]['datas'].decode('base64')
|
content = bundle[0]['datas'].decode('base64')
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue