Quantcast

Basics about passing variable to the user's session

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Basics about passing variable to the user's session

Germán Rimoldi

Hi Guys! 


I need help passing variable to the user's session and calling this from a different function: Could you help me out with this?


First, I would like ot "set" a variable on the user's session.


@cherrypy.expose
def setter(self):
    email = "[hidden email]"
    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")        

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Basics about passing variable to the user's session

Germán Rimoldi
We have opened this issue on Stackoverflow, please your help! :)

http://stackoverflow.com/questions/41539543/how-to-store-cherrypy-session-in-a-variable

On Sunday, January 8, 2017 at 7:42:28 PM UTC-3, Germán Rimoldi wrote:

Hi Guys! 


I need help passing variable to the user's session and calling this from a different function: Could you help me out with this?


First, I would like ot "set" a variable on the user's session.


@cherrypy.expose
def setter(self):
    email = "[hidden email]"
    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")        

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Loading...