My index method is below:
@turbogears.expose(html="logintest.templates.loginsuccess")
def index(self):
for key,item in cherrypy.request.simpleCookie.items ():
if key =="name": #get a cookis
name=cherrypy.request.simpleCookie["name"].value
return dict(name=name)
esle:
raise cherrypy.HTTPRedirect(turbogears.url("/loginclass/loginwelcome"))
when I click loginout, the index page is showing that:
your login name is:python
Please click this loginOut
the cookie name still exists. faint
On 8/12/06, Lee McFadden
<[EMAIL PROTECTED]> wrote:
Try using a try/except to get it working.
try:
cherrypy.response.simpleCookie['name']['expires']=0
turbogears.flash("you are login out!")
raise cherrypy.HTTPRedirect(turbogears.url("/loginclass/index"))
except KeyError:
turbogears.flash("you are not login!")
raise cherrypy.HTTPRedirect(turbogears.url("/loginclass/index"))
This will prevent your app from giving you a 500 error, but I'm not
sure if it will solve the issue of the phantom key. Your previous
code is correct but for some odd reason the 'name' key in your
simpleCookie is dissapearing between the time you test .has_key and
when you try to access it.
Lee
--
Lee McFadden
blog: http://www.splee.co.uk
work: http://fireflisystems.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

