minor fixes

bzr revid: al@openerp.com-20121219024946-6ezbvcizf09w8lio
This commit is contained in:
Antony Lesuisse 2012-12-19 03:49:46 +01:00
parent 0ad1f09831
commit 3e1bce4bad
4 changed files with 8 additions and 28 deletions

View File

@ -1,6 +1,5 @@
import http import http
import controllers import controllers
import cli import cli
from . import ir_module
wsgi_postload = http.wsgi_postload wsgi_postload = http.wsgi_postload

View File

@ -480,7 +480,7 @@ class Root(object):
self.addons = {} self.addons = {}
self.statics = {} self.statics = {}
self._load_addons() self.load_addons()
# Setup http sessions # Setup http sessions
path = session_path() path = session_path()
@ -493,7 +493,7 @@ class Root(object):
""" """
return self.dispatch(environ, start_response) return self.dispatch(environ, start_response)
def _dispatch(self, environ, start_response): def dispatch(self, environ, start_response):
""" """
Performs the actual WSGI dispatching for the application, may be Performs the actual WSGI dispatching for the application, may be
wrapped during the initialization of the object. wrapped during the initialization of the object.
@ -529,11 +529,9 @@ class Root(object):
return response(environ, start_response) return response(environ, start_response)
def _load_addons(self): def load_addons(self):
""" """ Load all addons from addons patch containg static files and
Loads all addons at the specified addons path, returns a mapping of controllers and configure them. """
static URLs to the corresponding directories
"""
for addons_path in openerp.modules.module.ad_paths: for addons_path in openerp.modules.module.ad_paths:
for module in os.listdir(addons_path): for module in os.listdir(addons_path):
@ -559,7 +557,7 @@ class Root(object):
if hasattr(o, '_cp_path'): if hasattr(o, '_cp_path'):
controllers_path[o._cp_path] = o controllers_path[o._cp_path] = o
app = werkzeug.wsgi.SharedDataMiddleware(self._dispatch, self.statics) app = werkzeug.wsgi.SharedDataMiddleware(self.dispatch, self.statics)
self.dispatch = DisableCacheMiddleware(app) self.dispatch = DisableCacheMiddleware(app)
def find_handler(self, *l): def find_handler(self, *l):

View File

@ -1,17 +0,0 @@
from openerp.osv import osv
import openerp.service.wsgi_server as oewsgi
from .http import Root
class ir_module(osv.Model):
_inherit = 'ir.module.module'
def update_list(self, cr, uid, context=None):
result = super(ir_module, self).update_list(cr, uid, context=context)
if tuple(result) != (0, 0):
for handler in oewsgi.module_handlers:
if isinstance(handler, Root):
handler._load_addons()
return result

View File

@ -1326,7 +1326,7 @@ instance.web.EmbeddedClient = instance.web.Client.extend({
_template: 'EmbedClient', _template: 'EmbedClient',
init: function(parent, origin, dbname, login, key, action_id, options) { init: function(parent, origin, dbname, login, key, action_id, options) {
this._super(parent, origin); this._super(parent, origin);
this.bind(dbname, login, key); this.bind_credentials(dbname, login, key);
this.action_id = action_id; this.action_id = action_id;
this.options = options || {}; this.options = options || {};
}, },
@ -1365,7 +1365,7 @@ instance.web.EmbeddedClient = instance.web.Client.extend({
return instance.session.session_authenticate(this.dbname, this.login, this.key, true); return instance.session.session_authenticate(this.dbname, this.login, this.key, true);
}, },
bind: function(dbname, login, key) { bind_credentials: function(dbname, login, key) {
this.dbname = dbname; this.dbname = dbname;
this.login = login; this.login = login;
this.key = key; this.key = key;