[FIX] http: when generating static routes, only wrap dispatcher only if there is any new static directory found
bzr revid: chs@openerp.com-20140324161257-fi1cpgyd97825b14
This commit is contained in:
parent
e5f645df4d
commit
a8e1aba23b
|
@ -1089,17 +1089,14 @@ class Root(object):
|
|||
""" Handle a WSGI request
|
||||
"""
|
||||
if not self._loaded:
|
||||
self.load_addons()
|
||||
self._loaded = True
|
||||
self.load_addons()
|
||||
return self.dispatch(environ, start_response)
|
||||
|
||||
def load_addons(self):
|
||||
""" Load all addons from addons patch containg static files and
|
||||
controllers and configure them. """
|
||||
# TODO should we move this to ir.http so that only configured modules are served ?
|
||||
_logger.info("HTTP Configuring static files")
|
||||
|
||||
self.__dict__.pop('dispatch', None)
|
||||
statics = {}
|
||||
|
||||
for addons_path in openerp.modules.module.ad_paths:
|
||||
|
@ -1113,10 +1110,14 @@ class Root(object):
|
|||
_logger.debug("Loading %s", module)
|
||||
if 'openerp.addons' in sys.modules:
|
||||
m = __import__('openerp.addons.' + module)
|
||||
else:
|
||||
m = None
|
||||
addons_module[module] = m
|
||||
addons_manifest[module] = manifest
|
||||
statics['/%s/static' % module] = path_static
|
||||
|
||||
if statics:
|
||||
_logger.info("HTTP Configuring static files")
|
||||
app = werkzeug.wsgi.SharedDataMiddleware(self.dispatch, statics)
|
||||
self.dispatch = DisableCacheMiddleware(app)
|
||||
|
||||
|
|
Loading…
Reference in New Issue