Launchpad automatic translations update.
[odoo/odoo.git] / openerp / http.py
1 # -*- coding: utf-8 -*-
2
3 """
4 ``openerp.http`` offers decorators to register WSGI and RPC endpoints handlers.
5 See :ref:`routing`.
6 """
7
8 from . import service
9
10 def handler():
11     """
12     Decorator to register a WSGI handler. The handler must return None if it
13     does not handle the request.
14     """
15     def decorator(f):
16         service.wsgi_server.register_wsgi_handler(f)
17     return decorator
18
19 def route(url):
20     """
21     Same as then handler() decorator but register the handler under a specific
22     url. Not yet implemented.
23     """
24     def decorator(f):
25         pass # TODO
26     return decorator
27
28 def rpc(endpoint):
29     """
30     Decorator to register a RPC endpoint handler. The handler will receive
31     already unmarshalled RCP arguments.
32     """
33     def decorator(f):
34         service.wsgi_server.register_rpc_endpoint(endpoint, f)
35     return decorator
36
37 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: