Controllers need to provide extensibility, much like Model, but can't use the same mechanism as the pre-requisites and database with loaded modules.
Controllers are provide their own extension mechanism, separate from that of models:
Controllers are created by inheriting from
class openerp.http.Controller
and defining methods decorated with route(): For example code is below.
class MyController(openerp.http.Controller):
@route('/some_url', auth='public')
def handler(self):
return stuff()
And override a controller, inherit from its class and override relevant methods,
class Extension(MyController):
@route()
def handler(self):
do_before()
return super(Extension, self).handler()
Note- Controllers thus provide their own extension mechanism, separate from that of models.
0 Comment(s)