Yes this method works but this way you loose the last visited page. For exemple, if you're logged and looking at a download page, when you click download, you get redirected to /logout page, then you don't come back to the download page. Having the filter to handle that make logout possible from the download page and the page is just refreshed with the new permission...

Ben
Le 16 nov. 05 à 02:39, Jason Chu a écrit :

On Wed, Nov 16, 2005 at 12:46:15AM +0100, Benoit Masson wrote:

   Hi I'm trying to add a logout fonction to the identity filter.

   So I've made a logout form:

   <form action="" method="POST">

           <input type="hidden" name="f_logout" id="f_logout"
   value="true"/>

           <input type="submit" value="logout"/>

           </form>

   Then in the filter.py I've tried to add

   logout_field= params.pop("f_logout") (on line 138 latest
SVN) (for testing I wrote the "f_logout" but I'll then use the config
   file for that.

   I was about to add a test if logout_field=="true":

   identity= None

   But when I do that I get the following error:

   Traceback (most recent call last):

     File
"/Users/benoitm/Python2.4.2/lib/python2.4/site-packages/ CherryPy-2.1.0
   -py2.4.egg/cherrypy/_cphttptools.py", line 271, in run

       main()

     File
"/Users/benoitm/Python2.4.2/lib/python2.4/site-packages/ CherryPy-2.1.0
   -py2.4.egg/cherrypy/_cphttptools.py", line 502, in main

       body = page_handler(*args, **cherrypy.request.paramMap)

     File
"/Users/benoitm/developpement/workspace/trunk/turbogears/ controllers.p
   y", line 205, in newfunc

       output = func(self, *args, **kw)

   TypeError: index() got an unexpected keyword argument 'f_logout'

When I did this, I just created a /logout path that called
turbogears.identity.current.logout(). That seemed to work fine for me...

Jason

--
If you understand, things are just as they are. If you do not understand,
things are just as they are.

Reply via email to