[MERGE] merge trunk-owp-648324
bzr revid: al@openerp.com-20121219025429-h4wn6tlhtvn2xpzg
This commit is contained in:
+11
-11
@@ -478,10 +478,9 @@ class Root(object):
|
||||
"""
|
||||
def __init__(self):
|
||||
self.addons = {}
|
||||
self.statics = {}
|
||||
|
||||
static_dirs = self._load_addons()
|
||||
app = werkzeug.wsgi.SharedDataMiddleware( self.dispatch, static_dirs)
|
||||
self.dispatch = DisableCacheMiddleware(app)
|
||||
self.load_addons()
|
||||
|
||||
# Setup http sessions
|
||||
path = session_path()
|
||||
@@ -530,12 +529,10 @@ class Root(object):
|
||||
|
||||
return response(environ, start_response)
|
||||
|
||||
def _load_addons(self):
|
||||
"""
|
||||
Loads all addons at the specified addons path, returns a mapping of
|
||||
static URLs to the corresponding directories
|
||||
"""
|
||||
statics = {}
|
||||
def load_addons(self):
|
||||
""" Load all addons from addons patch containg static files and
|
||||
controllers and configure them. """
|
||||
|
||||
for addons_path in openerp.modules.module.ad_paths:
|
||||
for module in sorted(os.listdir(addons_path)):
|
||||
if module not in addons_module:
|
||||
@@ -551,14 +548,17 @@ class Root(object):
|
||||
m = __import__(module)
|
||||
addons_module[module] = m
|
||||
addons_manifest[module] = manifest
|
||||
statics['/%s/static' % module] = path_static
|
||||
self.statics['/%s/static' % module] = path_static
|
||||
|
||||
for k, v in controllers_class:
|
||||
if k not in controllers_object:
|
||||
o = v()
|
||||
controllers_object[k] = o
|
||||
if hasattr(o, '_cp_path'):
|
||||
controllers_path[o._cp_path] = o
|
||||
return statics
|
||||
|
||||
app = werkzeug.wsgi.SharedDataMiddleware(self.dispatch, self.statics)
|
||||
self.dispatch = DisableCacheMiddleware(app)
|
||||
|
||||
def find_handler(self, *l):
|
||||
"""
|
||||
|
||||
@@ -819,6 +819,16 @@
|
||||
margin-top: 1px;
|
||||
background-color: #f6cf3b;
|
||||
}
|
||||
.openerp .oe_dialog_warning {
|
||||
width: 100%;
|
||||
}
|
||||
.openerp .oe_dialog_warning p {
|
||||
text-align: center;
|
||||
}
|
||||
.openerp .oe_dialog_icon {
|
||||
padding: 5px;
|
||||
width: 32px;
|
||||
}
|
||||
.openerp .oe_login {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=);
|
||||
text-align: center;
|
||||
|
||||
@@ -696,6 +696,15 @@ $sheet-padding: 16px
|
||||
margin-top: 1px
|
||||
background-color: #f6cf3b
|
||||
// }}}
|
||||
// CrashManager {{{
|
||||
.oe_dialog_warning
|
||||
width: 100%
|
||||
p
|
||||
text-align: center
|
||||
.oe_dialog_icon
|
||||
padding: 5px
|
||||
width: 32px
|
||||
// }}}
|
||||
// Login {{{
|
||||
.oe_login
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=)
|
||||
|
||||
@@ -691,6 +691,7 @@ instance.web.Login = instance.web.Widget.extend({
|
||||
});
|
||||
instance.web.client_actions.add("login", "instance.web.Login");
|
||||
|
||||
|
||||
/**
|
||||
* Redirect to url by replacing window.location
|
||||
* If wait is true, sleep 1s and wait for the server i.e. after a restart.
|
||||
@@ -1368,17 +1369,17 @@ instance.web.EmbeddedClient = instance.web.Client.extend({
|
||||
_template: 'EmbedClient',
|
||||
init: function(parent, origin, dbname, login, key, action_id, options) {
|
||||
this._super(parent, origin);
|
||||
|
||||
this.dbname = dbname;
|
||||
this.login = login;
|
||||
this.key = key;
|
||||
this.bind_credentials(dbname, login, key);
|
||||
this.action_id = action_id;
|
||||
this.options = options || {};
|
||||
},
|
||||
start: function() {
|
||||
var self = this;
|
||||
return $.when(this._super()).then(function() {
|
||||
return instance.session.session_authenticate(self.dbname, self.login, self.key, true).then(function() {
|
||||
return self.authenticate().then(function() {
|
||||
if (!self.action_id) {
|
||||
return;
|
||||
}
|
||||
return self.rpc("/web/action/load", { action_id: self.action_id }).done(function(result) {
|
||||
var action = result;
|
||||
action.flags = _.extend({
|
||||
@@ -1389,11 +1390,30 @@ instance.web.EmbeddedClient = instance.web.Client.extend({
|
||||
//pager : false
|
||||
}, self.options, action.flags || {});
|
||||
|
||||
self.action_manager.do_action(action);
|
||||
self.do_action(action);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
do_action: function(action) {
|
||||
return this.action_manager.do_action(action);
|
||||
},
|
||||
|
||||
authenticate: function() {
|
||||
var s = instance.session;
|
||||
if (s.session_is_valid() && s.db === this.dbname && s.login === this.login) {
|
||||
return $.when();
|
||||
}
|
||||
return instance.session.session_authenticate(this.dbname, this.login, this.key, true);
|
||||
},
|
||||
|
||||
bind_credentials: function(dbname, login, key) {
|
||||
this.dbname = dbname;
|
||||
this.login = login;
|
||||
this.key = key;
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
instance.web.embed = function (origin, dbname, login, key, action, options) {
|
||||
|
||||
@@ -30,6 +30,12 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
|
||||
* Setup a sessionm
|
||||
*/
|
||||
session_bind: function(origin) {
|
||||
if (!_.isUndefined(this.origin)) {
|
||||
if (this.origin === origin) {
|
||||
return $.when();
|
||||
}
|
||||
throw new Error('Session already bound to ' + this.origin);
|
||||
}
|
||||
var self = this;
|
||||
this.setup(origin);
|
||||
instance.web.qweb.default_dict['_s'] = this.origin;
|
||||
|
||||
@@ -36,11 +36,11 @@
|
||||
<t t-name="CrashManager.warning">
|
||||
<table cellspacing="0" cellpadding="0" border="0" class="oe_dialog_warning">
|
||||
<tr>
|
||||
<td><img t-att-src='_s + "/web/static/src/img/warning.png"' class="oe_dialog_icon"/></td>
|
||||
<td class="oe_dialog_icon"><img t-att-src='_s + "/web/static/src/img/warning.png"'/></td>
|
||||
<td>
|
||||
<p>
|
||||
<t t-js="d">
|
||||
var message = d.message ? d.message : d.error.data.fault_code;
|
||||
var message = d.error.message ? d.error.message : d.error.data.fault_code;
|
||||
d.html_error = context.engine.tools.html_escape(message)
|
||||
.replace(/\n/g, '<br/>');
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user