[FIX] qweb loading concat mode only, increase cache age to one day

bzr revid: al@openerp.com-20140501204242-jngte754yqyj4nb0
This commit is contained in:
Antony Lesuisse 2014-05-01 22:42:42 +02:00
parent eb44c37dd9
commit aa943fae18
2 changed files with 9 additions and 15 deletions

View File

@ -608,7 +608,7 @@ class Home(http.Controller):
# TODO: check that we don't do weird lazy overriding of __call__ which break body-removal
return make_conditional(
response, bundle.last_modified, bundle.checksum, max_age=60*5)
response, bundle.last_modified, bundle.checksum, max_age=60*60*24)
@http.route('/web/css/<xmlid>', type='http', auth='public')
def css_bundle(self, xmlid, **kw):
@ -623,7 +623,7 @@ class Home(http.Controller):
bundle.css(), [('Content-Type', 'text/css')])
return make_conditional(
response, bundle.last_modified, bundle.checksum, max_age=60*5)
response, bundle.last_modified, bundle.checksum, max_age=60*60*24)
class WebClient(http.Controller):
@ -635,10 +635,6 @@ class WebClient(http.Controller):
def jslist(self, mods=None):
return manifest_list('js', mods=mods)
@http.route('/web/webclient/qweblist', type='json', auth="none")
def qweblist(self, mods=None):
return manifest_list('qweb', mods=mods)
@http.route('/web/webclient/qweb', type='http', auth="none")
def qweb(self, mods=None, db=None):
files = [f[0] for f in manifest_glob('qweb', addons=mods, db=db)]

View File

@ -232,7 +232,7 @@ instance.web.Session.include( /** @lends instance.web.Session# */{
var self = this;
return this.session_reload().then(function(result) {
var modules = instance._modules.join(',');
var deferred = self.rpc('/web/webclient/qweblist', {mods: modules}).then(self.load_qweb.bind(self));
var deferred = self.load_qweb(modules);
if(self.session_is_valid()) {
return deferred.then(function() { return self.load_modules(); });
}
@ -318,7 +318,7 @@ instance.web.Session.include( /** @lends instance.web.Session# */{
loaded = $.when(
loaded,
self.rpc('/web/webclient/csslist', {mods: to_load}).done(self.load_css.bind(self)),
self.rpc('/web/webclient/qweblist', {mods: to_load}).then(self.load_qweb.bind(self)),
self.load_qweb(to_load),
self.rpc('/web/webclient/jslist', {mods: to_load}).done(function(files) {
file_list = file_list.concat(files);
})
@ -375,14 +375,12 @@ instance.web.Session.include( /** @lends instance.web.Session# */{
}
return d;
},
load_qweb: function(files) {
load_qweb: function(mods) {
var self = this;
_.each(files, function(file) {
self.qweb_mutex.exec(function() {
return self.rpc('/web/proxy/load', {path: file}).then(function(xml) {
if (!xml) { return; }
instance.web.qweb.add_template(_.str.trim(xml));
});
self.qweb_mutex.exec(function() {
return self.rpc('/web/proxy/load', {path: '/web/webclient/qweb?mods=' + mods}).then(function(xml) {
if (!xml) { return; }
instance.web.qweb.add_template(_.str.trim(xml));
});
});
return self.qweb_mutex.def;