alexyun78 / webapp-improved

Automatically exported from code.google.com/p/webapp-improved
0 stars 0 forks source link

Can't destroy session #59

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
1. Set a value in a session
2. Destroy session
3. Get a value from the session

What is the expected output? What do you see instead?
There should be no value

Sample code:

class TestHandler(BaseHandler):
    def get(self):
        counter = self.session.get('counter')
        if not counter:
            counter = 0
        counter += 1

        if counter > 5:
            self.auth.unset_session()
        else:
            self.session['counter'] = counter

        return self.response.write ( counter )

Original issue reported on code.google.com by broadysm...@gmail.com on 14 Jul 2012 at 6:59

GoogleCodeExporter commented 8 years ago
Depends on how you define self.auth. Default is auth and session are different 
things and are set on different cookies ("auth" vs "session").  

So, auth.unset_session() does what is says - clears authentication stuff from 
the session:
http://webapp-improved.appspot.com/_modules/webapp2_extras/auth.html#Auth.unset_
session

Original comment by a...@cloudware.it on 20 Sep 2012 at 9:39

GoogleCodeExporter commented 8 years ago
Thanks for clarifying this!

Original comment by broadysm...@gmail.com on 20 Sep 2012 at 11:27