Thursday, 15 April 2010

python - How can I extend web module in OpenERP -



python - How can I extend web module in OpenERP -

in web module (addons/web) exist of routes (many of them) in openerp, example:

/ /web /web/login

etc. want extend web module create other ways (routes) of clients registration. created module web_aaa (for testing) , in controller include (almost code copied web/controllers/main.py class home):

# -*- coding: utf-8 -*- import logging import jinja2 import simplejson import os import sys import openerp openerp import http openerp.http import request, serialize_exception _serialize_exception _logger = logging.getlogger(__name__) if hasattr(sys, 'frozen'): path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'views')) loader = jinja2.filesystemloader(path) else: loader = jinja2.packageloader('openerp.addons.web', "views") env = jinja2.environment(loader=loader, autoescape=true) env.filters["json"] = simplejson.dumps class home_aaa(http.controller): #this new route @http.route('/signup', type='http', auth="none") def signup(self, **kw): homecoming env.get_template("signup.html").render()

then, when start server with "--load web_aaa" , lookup /signup works fine. but others routes of web module homecoming 404 not found (none werkzeug: 192.168.56.1 - - [10/nov/2014 19:00:44] "get /web/ http/1.1" 404 -).

and when i start server without "--load web_aaa" routes of web module works great, but web_aaa routes not.

my questions are:

how can create module create new routes, or extend web module, main.py controller? the web module server_wide_module, changed alternative in config file web_aaa module doesn't start. how can include server wide module?

thanks much!!

your cant test:

from web.controllers.main import home

class home_aaa(home):

http.route('/signup', type='http', auth="none") def signup(self, **kw): homecoming env.get_template("signup.html").render()

python openerp-8

No comments:

Post a Comment