[IMP] determine openerp_addons_namespace dynamically

bzr revid: al@openerp.com-20120902170556-vkt2a936am4vrmmc
This commit is contained in:
Antony Lesuisse 2012-09-02 19:05:56 +02:00
parent d7a2ea78dc
commit 1699e4dc97
2 changed files with 5 additions and 5 deletions

View File

@ -461,7 +461,7 @@ class Root(object):
only used in case the list of databases is requested
by the server, will be filtered by this pattern
"""
def __init__(self, options, openerp_addons_namespace=True):
def __init__(self, options):
self.config = options
if not hasattr(self.config, 'connector'):
@ -474,7 +474,7 @@ class Root(object):
self.httpsession_cookie = 'httpsessionid'
self.addons = {}
static_dirs = self._load_addons(openerp_addons_namespace)
static_dirs = self._load_addons()
if options.serve_static:
app = werkzeug.wsgi.SharedDataMiddleware( self.dispatch, static_dirs)
self.dispatch = DisableCacheMiddleware(app)
@ -520,7 +520,7 @@ class Root(object):
return response(environ, start_response)
def _load_addons(self, openerp_addons_namespace=True):
def _load_addons(self):
"""
Loads all addons at the specified addons path, returns a mapping of
static URLs to the corresponding directories
@ -535,7 +535,7 @@ class Root(object):
manifest = ast.literal_eval(open(manifest_path).read())
manifest['addons_path'] = addons_path
_logger.debug("Loading %s", module)
if openerp_addons_namespace:
if 'openerp.addons' in sys.modules:
m = __import__('openerp.addons.' + module)
else:
m = __import__(module)

View File

@ -105,7 +105,7 @@ if __name__ == "__main__":
else:
logging.basicConfig(level=getattr(logging, options.log_level.upper()))
app = web.common.http.Root(options, openerp_addons_namespace=False)
app = web.common.http.Root(options)
if options.proxy_mode:
app = werkzeug.contrib.fixers.ProxyFix(app)