Community mailing list archives

community@mail.odoo.com

Re: Understanding Session to handle the login of the user

by
Antony Lesuisse (al)
- 07/29/2015 12:36:38
The session_context is a context manager to ensure that the session is written 
to disk at the end of the request whatever happens during the request.

On every request what happens is if we can find a cookie and there is a 
corresponding saved session file we unserialized it and it's the 
request.session pseudo dict. If not a new empty one is created. At the end of 
the request is the pseudo dict is dirty we save it back to the disk.

It's very similar to PHP session and it uses the werkzeug implementation 
documented here

http://werkzeug.pocoo.org/docs/0.10/contrib/sessions/

Around every 1000 request we delete session not used since 1 week.

On 07/29/2015 09:43 AM, Devang Pipaliya wrote:
> Hello everyone,
>
> This is about openerp-v7.
>
> Can anyone help to under stand the "session_context  " and"session_gc  "?
> https://github.com/odoo/odoo/blob/7.0/addons/web/http.py#L388  &
> https://github.com/odoo/odoo/blob/7.0/addons/web/http.py#L447
>
> What is the role of them? How the odoo is selecting the session and
> making it as an active one?
>
> What I understood till now is;
> Odoo is using the werkzeug lib is saving the sessions in the files under
> temp directory.
> But I am still confuse how the Odoo is taking a session from list of
> multiple sessions stored in multiple files from this temp directory.
> Even though we have cleared the cookies, Odoo is taking the session and
> regenerating the cookies from here.
>
> Can any one guide me on this please?
>
> It would be a great help.
>
> --
> Thanks & Regards,
> Devang H. Pipaliya,
>
>
> *​--*
> *Regards,*
> **
> 
> --
> 		
> Devang Pipaliya
> http://about.me/DevanGPipaliyA
>
> *​" Have a nice rest of the remaining day ! "​​ *
>
> _______________________________________________
> Mailing-List: https://www.odoo.com/groups/community-59
> Post to: mailto:community@mail.odoo.com
> Unsubscribe: https://www.odoo.com/groups?unsubscribe
>