Hi again,

Thanks for all the help. I was concerned I'd get laughed away. I think
somewhere along the line I got my wires crossed. I saw the counter
example in the (very draft) manual, but surely missed the point. I
then found myself trying to use session.connect(...) in conjunction
with session."myvariable", and wondered why it wasn't working! It's so
easy when you know how...

Loving the web2py.

Thanks once again for all the help, I'm sure I'll have some other
question soon enough, if I can't figure it out from previous
posts. :o)

LB

On 15 Jan, 14:12, mdipierro <mdipie...@cs.depaul.edu> wrote:
> try this simple complete program (without session.connect(...))
>
> def index():
>     if not session.c: session.c=0
>     session.c+=1
>     return dict(counter=session.c)
>
> when you reload the index page does it increment the counter? It not
> you ma have cookies disabled.
>
> By default sessions are handled for you and stored in session/*
> You should only use session.connect(...) if you prefer to have
> sessions stored in database (slower but needed if you have multiple
> servers).
> Either case, session cookies, storing and retrieving is handled for
> you.
>
> Massimo
>
> On Jan 15, 1:10 am, LB22 <latn.bl...@googlemail.com> wrote:
>
> > Hi all,
>
> > I've been using web2py for a couple of weeks and am slowly getting the
> > hang of it, but I'm still pretty much a newbie to web programming.
>
> > I've been trying to figure out how to handle sessions but have made
> > little progress in the past couple of days. The manual, (and website)
> > states that web2py handles sessions for you... I took this to mean
> > that, beyond using session.connect(...) to initiate/create a session
> > in the database, all you needed to do was store the session data in
> > various session variables like session.example_data1="some user",
> > session.exampledata2 ="same user's preferred colour scheme", and these
> > session variables would get sent and retrieve as they were created and
> > then referenced.
>
> > This doesn't seem to be the case though (forgive my naivety). The
> > sessions are definitely getting created in the DB, and I can see the
> > cookies have the same unique_keys as the sessions created but, beyond
> > this, I'm stuck. So would someone please explain briefly how to send
> > and retrieve session data to/from the [mysql] database to utilise it
> > within the application, and maybe provide a quick example?
>
> > Thanks in advance.
>
> > LB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to