Re: [Myghty-users] session problem
Brought to you by:
zzzeek
From: mike b. <mi...@my...> - 2005-01-06 15:27:40
|
ah, reread your email....with the example I gave, pressing the reload button on the browser works as well, it returns the same session ID each time. one cool way to see what is happening is to use firefox with the HTTP headers plugin, at http://livehttpheaders.mozdev.org/ , i am using it here and the headers seem OK. - mike > > David - > > its pretty possible the session has a bug in it, as this is all new code > and i am only beginning to get feedback on any of it. But you are saying > the call to get_session inside of the subexec() is not returning the same > session as that of the initial module component, within the same request ? > that is even weirder since the subrequest should be referencing the same > instance of the session. > > I have just tried with the standalone server, using .96e, which has a > slight adjustment in the area of subrequests in fact but it *shouldnt* be > an issue with .96d, these two pages: > > index.myt > ---------------- > hello world > > % sess = m.get_session(session_key='mykey', session_secret='secret', > session_timeout = 1000) > > the session is <% repr(sess) | h %> the id is <% sess.id %> > > % g = m.create_subrequest('bar.myt') > % g.execute() > > bar.myt > --------------- > > i am bar > > % sess = m.get_session(session_key='mykey', session_secret='secret', > session_timeout = 1000) > > the session is <% repr(sess) | h %> the id is <% sess.id %> > > > --------------------- > > and it produces: > > hello world the session is <myghty.session.Session instance at 0xa271b6c> > the id is 71661cb0d0546e8ce3a3f1aa844ab397 i am bar the session is > <myghty.session.Session instance at 0xa271b6c> the id is > 71661cb0d0546e8ce3a3f1aa844ab397 > > which is correct, not only is the new session id the same, but its the > exact same object instance. > > is that similar to your case ? > > - mike > > > >> Hi, >> >> I am not sure Session (Myghty 96d) is working correctly (or, most >> probably, it is *I* who is not working correctly). >> >> The way I understand it, is to get the session you say something like: >> >> mysession = m.get_session(session_key="abc", session_secret="secret", >> session_timeout=1000) >> >> Look at mysession, do stuff, and if you change it, do a >> mysession.save(). >> >> >> If you make the identical call to m.get_session(....) again, should't >> you get the same session (session.key the same), unless it has expired? >> >> Well, using a module component, if I come through via a GET (via a URL) >> and read the session I get one value. I display a template via >> m.subexec(). If I display the page again via a Reload in the browser >> (same URL), the session.id is different the next time around! (and >> cookies are indeed being set) >> >> Note: I am using the test server. (maybe this is the problem?) >> >> >> Code is something like this: >> >> URL: http://..../login >> >> "/login" corresponds to qaLogin:Login via server directive. >> >> -------------------------------------------------------- >> class Login(component.ModuleComponent): >> >> def do_run_component(self, m,..., **params): >> >> session = m.get_session(session_key="qadmin",....) >> print "key=", session.id >> >> r = params['r'] >> if r.method == 'GET': >> m.subexec('login.myt', **params) >> return >> >> elif r.method == 'POST': >> ..code for POST.... >> ------------------------------------- >> login.myt >> >> has a POST action for '/login' >> >> >> Thanks, >> David >> >> >> >> >> >> >> ------------------------------------------------------- >> The SF.Net email is sponsored by: Beat the post-holiday blues >> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. >> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt >> _______________________________________________ >> Myghty-users mailing list >> Myg...@li... >> https://lists.sourceforge.net/lists/listinfo/myghty-users >> > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Myghty-users mailing list > Myg...@li... > https://lists.sourceforge.net/lists/listinfo/myghty-users > |