1

I am trying to build a website in python webpy framework and I am having trouble in cache-control of web browser. When the user presses the back button of the browser it goes back to the userpage even though the user has logged out.

My code looks like this - it has errors but I am not sure how it is done

class Logout:
    web.header("Cache-Control",
           "no-cache, max-age=0, must-revalidate, no-store")
    def GET(self):
        session.login=0
        session.kill()
        raise web.seeother('/')

Any help would be appreciated. I am actually looking for the python code because I have no idea where that "web.header" is to be placed.

Kiran KN
  • 85
  • 1
  • 10
  • Possible duplicate of [Avoid back button on JSF web application](http://stackoverflow.com/questions/10305718/avoid-back-button-on-jsf-web-application) – Joe Jan 18 '16 at 10:28
  • If you know python can you please tell me where am I going wrong in the above code? – Kiran KN Jan 18 '16 at 14:30

1 Answers1

1

You put your web.header directives inside the actual GET and SET methods on the classes.

So your case would be:

class Logout:

    def GET(self):
        web.header("Cache-Control", "no-cache, max-age=0, must-revalidate, no-store")
        session.login=0
        session.kill()
        raise web.seeother('/')
apusateri
  • 58
  • 3