[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:
Olivier Dony 2014-09-03 18:44:22 +02:00
parent a03dfefda9
commit 491162e653
1 changed files with 1 additions and 1 deletions

View File

@ -1144,7 +1144,7 @@ class AssetsBundle(object):
content = None
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)
if bundle:
if bundle and bundle[0]['datas']:
content = bundle[0]['datas'].decode('base64')
return content