Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
6070 Представления

I try to do the openerp tutorial doc.openerp.com/trunk/web/web_controllers/

but it fail :/

controllers/main.py

try:
    import openerp.addons.web.common.http as openerpweb
except ImportError:
    import web.common.http as openerpweb    # noqa

class main(openerpweb.Controller):

    @openerpweb.route('/some_html', type="http")
    def some_html(self):
        return "<h1>This is a test</h1>"

    @openerpweb.route('/some_json', type="json")
    def some_json(self):
        return {"sample_dictionary": "This is a sample JSON dictionary"}

The error:

2013-07-01 12:32:47,017 20491 CRITICAL ? openerp.modules.module: Couldn't load module web 2013-07-01 12:32:47,017 20491 CRITICAL ? openerp.modules.module: 'module' object has no attribute 'route' 2013-07-01 12:32:47,018 20491 ERROR ? openerp: Failed to load server-wide module web.

But the module path is correct and openerp works without this.

openerp path:

./openerp-server --addons=../addons,../web/addons

Thanks in advance for your help ;)

Аватар
Отменить

under which version of OpenERP you are working ?

Лучший ответ

The http object has no attribute 'route'
_cp_path = '/some_html'

@http.httprequest
def some_html(self, req):

Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
нояб. 19
3337
2
мая 18
6148
2
дек. 23
1676
2
февр. 23
12478
0
июн. 21
2591