I have started using CherryPy on a project. I love it because of it's simplicity but the learning curve has been steep because of the lack of documentation.
First, I would like ot "set" a variable on the user's session.
@cherrypy.expose
def setter(self):
email = "[email protected]"
cherrypy.session["email"] = email
return "Variable passed to session"
Second, I would like to call that variable from the session on a different function.
@cherrypy.expose
def getter(self):
return cherrypy.session.get("email")
Your "set" example is correct.
cherrypy.session["email"] = email
But your "get" example should just be:
return cherrypy.session["email"]