and this is the webapp example:

#!/usr/bin/env python

import gmemsess
import wsgiref.handlers
from google.appengine.ext import webapp

#----------------------------------------------------------------------
class MainHandler(webapp.RequestHandler):
        #----------------------------------------------------------
        def get(self):
                sess=gmemsess.Session(self)
                if sess.is_new():
                        self.response.out.write('New session - setting counter 
to 0.<br>')
                        sess['myCounter']=0
                        sess.save()
                else:
                        sess['myCounter']+=1
                        self.response.out.write('Session counter is 
%d.'%sess['myCounter'])
                        if sess['myCounter']<3:
                                sess.save()
                        else:
                                self.response.out.write(' Invalidating cookie.')
                                sess.invalidate()


#------------------------------------------------------------
def main():
        application=webapp.WSGIApplication([('/',MainHandler)],debug=True)
        wsgiref.handlers.CGIHandler().run(application)


if __name__=='__main__':
        main()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to