def routing_map(self): if not hasattr(self, '_routing_map'): _logger.info("Generating routing map") installed = request.registry._init_modules - {'web'} if tools.config['test_enable']: installed.add(odoo.modules.module.current_test) mods = [''] + odoo.conf.server_wide_modules + sorted(installed) self._routing_map = http.routing_map(mods, False, converters=self._get_converters()) return self._routing_map
def routing_map(self): if not hasattr(self, '_routing_map'): _logger.info("Generating routing map") installed = request.registry._init_modules - {'web'} if tools.config['test_enable']: installed.add(odoo.modules.module.current_test) mods = [''] + odoo.conf.server_wide_modules + sorted(installed) self._routing_map = http.routing_map( mods, False, converters=self._get_converters()) return self._routing_map
def routing_map(cls): if not hasattr(cls, '_routing_map'): _logger.info("Generating routing map") installed = request.registry._init_modules - {'web'} if tools.config['test_enable']: installed.add(odoo.modules.module.current_test) mods = [''] + odoo.conf.server_wide_modules + sorted(installed) # Note : when routing map is generated, we put it on the class `cls` # to make it available for all instance. Since `env` create an new instance # of the model, each instance will regenared its own routing map and thus # regenerate its EndPoint. The routing map should be static. cls._routing_map = http.routing_map(mods, False, converters=cls._get_converters()) return cls._routing_map
def routing_map(cls): if not hasattr(cls, '_routing_map'): _logger.info("Generating routing map") installed = request.registry._init_modules - {'web'} if tools.config['test_enable'] and odoo.modules.module.current_test: installed.add(odoo.modules.module.current_test) mods = [''] + odoo.conf.server_wide_modules + sorted(installed) # Note : when routing map is generated, we put it on the class `cls` # to make it available for all instance. Since `env` create an new instance # of the model, each instance will regenared its own routing map and thus # regenerate its EndPoint. The routing map should be static. cls._routing_map = http.routing_map(mods, False, converters=cls._get_converters()) return cls._routing_map
def _fetch_image(self, path): public_user = self.env.ref('base.public_user') session_store = root_wsgi.session_store session = session_store.new() session.update({ 'db': threading.current_thread().dbname, 'login': public_user.login, 'uid': public_user.id, 'context': self.env.context, }) werkzeug_env = EnvironBuilder(path).get_environ() werkzeug_request = WerkzeugRequest(werkzeug_env) werkzeug_request.session = session # construct an odoo request with this werkzeug request. request = http.HttpRequest(werkzeug_request) with request: request._env = self.env(user=public_user) endpoint, arguments = http.routing_map( self.env.registry._init_modules, False, self.env['ir.http']._get_converters()).bind_to_environ( werkzeug_env).match(return_rule=False, ) yield endpoint, arguments