Odoo运行机制(四)----URL路由

本文深入探讨Odoo的ir.http模块,讲解了从_ir_http_的_dispatch_方法到_http.routing_map_的URL路由过程,以及_openerp.http.HttpRequest_在请求处理中的作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ir.http

openrep.http.Root.dispatch()中,通过ir_http = request.registry['ir.http']得到base/ir.ir_http

 try:
     with openerp.tools.mute_logger('openerp.sql_db'):
         ir_http = request.registry['ir.http']
 except (AttributeError, psycopg2.OperationalError):   
     request.session.logout()
     result = _dispatch_nodb()
 else:
     result = ir_http._dispatch()

ir.http._dispatch

ir.http._dispatch调用ir.http._find_handler()

def _dispatch(self):    
        try:
            rule, arguments = self._find_handler(return_rule=True)
            func = rule.endpoint
        except werkzeug.exceptions.NotFound, e:
            return self._handle_exception(e)
       ...      
        try:
            request.set_handler(func, arguments, auth_method)#设置处理函数,在request.dispatch()中调用
            result = request.dispatch()
            
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值