sorry,the delete cookie code is below :
 @turbogears.expose()
def loginout(self):
      hasname=False
      for key,item in cherrypy.request.simpleCookie.items():
      if key == "name":  #get a cookis
            #cherrypy.response.simpleCookie["name"]["expires"]=0
           hasname=True
           break
     if hasname==True:
          cherrypy.response.simpleCookie["name"]["expires"]=0
          turbogears.flash("you are login out!")
          raise cherrypy.HTTPRedirect(turbogears.url("/index"))
     #there is no name cookie
     else:
          turbogears.flash("you are not login!")
          raise cherrypy.HTTPRedirect(turbogears.url("/index"))

why there is an errer:
 File "/home/ye/logintest/logintest/controllers.py", line 82, in
loginout
    cherrypy.response.simpleCookie["name"]["expires"]=0
KeyError: 'name'


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to