Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

session_id as GET parameter in URL returns 404

By
Christoph
on 9/29/15, 4:01 AM 1,196 views

Problem:

I wrote a new web controller in a new odoo addon - something like that:

@http.route('/web/somefunction', type='http', auth="none")
def somefunction(self, redirect='/web', **kw):
# render domething

Now if I open the URL with the parameter session_id odoo throws me 404. I also set the database with the parameter db but I think there should be no problem with the database because I use auth in the route definition.

The url:

http://localhost:8069/web/somefunction?db=somedb&session_id=61dd713f86c71c42fd72b92849deba77f451c15c

If I remove the session_id parameter the controller function is found and called.


Further information:

I need to set the session_id because I want to change the id. Here I use the functionality of openerp/http.py (class: Root, function: setup_session).

Also I created the session first (in another function which redirects to the "somefunction" controller function:

new_session = http.root.session_store.new()
new_session.db = request.session.db # just a test

So I use the session id of new_session. In my opinion this should work.


Do you have any ideas?

1

Axel Mendoza

--Axel Mendoza--
10238
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 9/29/15, 4:26 AM

Fix the line of route tha contains auth=''none

You put none outside of ''

It should be auth='none'

Thanks for the answer. But this was a copy-past-error. This is correct in my code.

Christoph
on 9/29/15, 1:11 PM
0
Ivan Yelizariev
On 10/22/15, 1:40 AM

I think this is default behaviour of http://werkzeug.pocoo.org/ tool -- it gets session_id from cookie or from get parameters.


As for redefining sessions, try to check this file: https://github.com/yelizariev/addons-yelizariev/blob/8.0/web_sessions_management/http.py

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/29/15, 4:01 AM
Seen: 1196 times
Last updated: 10/22/15, 1:40 AM