From 7b67b555f67ba480adda41c659f32c83bafdcc3f Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Wed, 7 Oct 2015 23:10:34 +0200 Subject: [PATCH] [FIX] ir_qweb: don't save buggy stylesheet assets If the compilation of a stylesheet asset produces any error, don't save it and instead output it debug-mode like. --- openerp/addons/base/ir/ir_qweb.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py index 07d956e0d88..dda6887a158 100644 --- a/openerp/addons/base/ir/ir_qweb.py +++ b/openerp/addons/base/ir/ir_qweb.py @@ -1181,8 +1181,15 @@ class AssetsBundle(object): else: url_for = self.context.get('url_for', lambda url: url) if css and self.stylesheets: - for attachment in self.css(): - response.append('' % url_for(attachment.url)) + css_attachments = self.css() + if not self.css_errors: + for attachment in css_attachments: + response.append('' % url_for(attachment.url)) + else: + msg = '\n'.join(self.css_errors) + self.stylesheets.append(StylesheetAsset(self, inline=self.css_message(msg))) + for style in self.stylesheets: + response.append(style.to_html()) if js and self.javascripts: response.append('' % (async and 'async="async"' or '', url_for(self.js().url))) response.extend(self.remains) @@ -1268,8 +1275,7 @@ class AssetsBundle(object): # get css content css = self.preprocess_css() if self.css_errors: - msg = '\n'.join(self.css_errors) - css += self.css_message(msg) + return # move up all @import rules to the top matches = []