I just came to ask about the same thing.

That example was the first-webpy-code-ever I tried to run, so I've
really no idea what's going on, but...

session.py seems OK in that the sessions are loaded/initialized
correctly. But I don't see where the magic is to make sure that the
handler gets the right data.

Printing the id() and data of the session in the main code, and in
session.py shows that there's 2 different session objects getting
created. The one that hits Session._load gets set up correctly, but
the other one doesn't, and is just empty (and that's the one that the
handler gets).

I guess something to do with the web server setup? I'm just using the
built-in one.

scott

On Nov 22, 1:16 pm, TheBoff <[EMAIL PROTECTED]> wrote:
> I'm having a look at this now. It's seems to be a very weird bug in
> the session library.
>
> I'll get back to you if I get anywhere.
> Colin
>
> On Nov 22, 8:01 pm, Tzury Bar Yochay <[EMAIL PROTECTED]> wrote:
>
> > this very sample taken fromhttp://webpy.org/cookbook/sessionsraises
> > an error when using git cloned of web.py from last week.
>
> > The error:
> > Traceback (most recent call last):
> >   File "/usr/lib/python2.5/site-packages/web/application.py", line
> > 182, in process
> >     return self.handle()
> >   File "/usr/lib/python2.5/site-packages/web/application.py", line
> > 172, in handle
> >     return self._delegate(fn, self.fvars, args)
> >   File "/usr/lib/python2.5/site-packages/web/application.py", line
> > 353, in _delegate
> >     return handle_class(cls)
> >   File "/usr/lib/python2.5/site-packages/web/application.py", line
> > 328, in handle_class
> >     return tocall(*args)
> >   File "/home/tzury/Desktop/sample_session.py", line 11, in GET
> >     session.count += 1
> >   File "/usr/lib/python2.5/site-packages/web/utils.py", line 830, in
> > __getattr__
> >     return getattr(self._getd(), key)
> >   File "/usr/lib/python2.5/site-packages/web/utils.py", line 64, in
> > __getattr__
> >     raise AttributeError, k
> > AttributeError: 'count'
>
> > The code:
>
> > import web
> > urls = (
> >     "/count", "count",
> >     "/reset", "reset"
> > )
> > app = web.application(urls, locals())
> > session = web.session.Session(app, web.session.DiskStore('sessions'),
> > initializer={'count': 0})
>
> > class count:
> >     def GET(self):
> >         session.count += 1
> >         return str(session.count)
>
> > class reset:
> >     def GET(self):
> >         session.kill()
> >         return ""
>
> > if __name__ == "__main__":
> >     app.run()
>
>
--~--~---------~--~----~------------~-------~--~----~
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