Try:

 auth.logout(onlogout=lambda user: session.update({'auth':None})) 


On Saturday, 4 January 2014 05:56:23 UTC-6, Wonton wrote:
>
> Hello Massimo,
>
> Thank you very much for your answer.
>
> I've made a copy&paste of your code, my code is now:
>
>  def logout():
>     if auth.user:
>         auth.logout(logout_onlogout=lambda user: session.auth=None)
>
> but I get a "invalid syntax error in line 154 char 61" trying to save the 
> file:
> line 154 is auth.logout(logout_onlogout=lambda user: session.auth=None)and 
> char 61 is '='.
>
> what am i doing wrong?
>
>
> On Saturday, January 4, 2014 3:38:06 AM UTC+1, Massimo Di Pierro wrote:
>>
>> No because auth.logout(next=...) redirects to he value of next. Next 
>> defaults to auth.settings.logout_next which is set to URL('index')
>>
>> What you want is:
>>
>> def logout():
>>     auth.logout(logout_onlogout=lambda user: session.auth=None)
>>
>> On Friday, 3 January 2014 19:44:43 UTC-6, Wonton wrote:
>>>
>>> Hello everyone,
>>>
>>> Recently I suffered the problem with the number of session files growing 
>>> very fast in my server. This worried me a lot because the server is a 
>>> development environment with only 4 or 5 testers, so when the number of 
>>> users is higher I guess I will have a big problem with this issue.
>>> I've tried to investigate about this but I'm not expert working with 
>>> web2py or with servers, so I have some questions:
>>>
>>> - A session file is created associated to a user each time that user 
>>> logs in. Is this ok?
>>> - My users make a login through auth.login_bare(user, password), does 
>>> this create a session file then?
>>> - What should be the code to remove the session file of a user when 
>>> he/she makes a logout?
>>> - I've set my auth.settings.expiration to 999999999, does this affect to 
>>> sessions too? As far as I know it only affects to when an inactive user is 
>>> automatically logged out, is this correct?
>>> - Testing this I've seen that with no logged users in my server, if I 
>>> manually remove the sessions files, some of them are created again!! Why 
>>> and how? As I said I have no users logged in the server.
>>>
>>> Regarding to the logout problem I've seen that my logout method is as 
>>> simple as this:
>>>
>>>  def logout():
>>>     if auth.user:
>>>         auth.log_event(auth.messages.logout_log, auth.user)
>>>     session.auth = None
>>>
>>> I don't really make a logout of the user so I change my method to this:
>>>
>>>  def logout():
>>>     if auth.user:
>>>         print 'check 1'
>>>         auth.logout()
>>>         print 'check 2'
>>>     session.auth = None
>>>
>>> But when this method is called, the output is this:
>>> check1
>>>
>>> check 2 is never printed so, has the user actually make a logout?
>>>
>>> I know they are a lot of questions, but any kind of help will be very 
>>> appreciated.
>>>
>>> Kind regards!
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to