[FIX] avoid having the XML concatenator blow up when passed an empty list of files ~/projects/tiny/web/current

turns out ElementTree has a hard time XML-serializing ``None`` (who'd
have guessed...), which is what it gets told to do when concat_xml is
called with an empty list of files.

Return an empty string and no timestamp (should probably be one there
at some point, but...) and fix the QWeb loader to not do anything when
it gets an empty template file.

bzr revid: xmo@openerp.com-20120113150641-6i3ot1jg7r3kpw3d
This commit is contained in:
Xavier Morel 2012-01-13 16:06:41 +01:00
parent a76f6d2a4e
commit c54d3337e6
2 changed files with 4 additions and 0 deletions

View File

@ -37,6 +37,9 @@ def concat_xml(file_list):
concat: concatenation of file content
timestamp: max(os.path.getmtime of file_list)
"""
if not file_list:
return '', None
root = None
files_timestamp = 0
for fname in file_list:

View File

@ -738,6 +738,7 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.
_.each(files, function(file) {
self.qweb_mutex.exec(function() {
return self.rpc('/web/proxy/load', {path: file}).pipe(function(xml) {
if (!xml) { return; }
openerp.web.qweb.add_template(_.str.trim(xml));
});
});