[albatross-users] Getting things *out* of session_vars?

Michael C. Neel neel at mediapulse.com
Wed Apr 23 08:41:07 EST 2003


You need to add the following line to the second part:

for v in all_vars:
    setarrt(ctx.locals,v, None)
    ctx.add_session_var(v)

I'm not sure where you would get the default value from, but if it needs
to be set to something other than none you'll need to change it.  Also,
make sure this happens in page_enter, not page_process, or you'll wipe
everything each request. Hth.

Mike

-----Original Message-----
From: VanL [mailto:vlindberg at verio.net] 
Sent: Tuesday, April 22, 2003 6:37 PM
To: Michael C. Neel; albatross-users at object-craft.com.au
Subject: Re: [albatross-users] Getting things *out* of session_vars?


My code looks like this:

all_vars = [var1, var2, var3]

for v in all_vars:
    if not ctx.req_equals(var) or
       ctx.get_value(var) != 'some good value':
       ctx.locals.error = 'var is set to bad value'

# If you get to here, all validation checks passed
for v in all_vars:
    ctx.add_session_var(v)

Sorry if some of the function names are slightly wrong, I am away from 
the code currently.  But this should be enough to give you an idea.

VanL

Michael C. Neel wrote:

>Are you etting up a cxt.locals member befor adding to the session?
>
>ie first
>ctx.local.var = "test"
> then...
>ctx.add_session_vars("var")
>
>mike
>
>-----Original Message-----
>From: VanL [mailto:vlindberg at verio.net]
>Sent: Tuesday, April 22, 2003 2:03 PM
>To: albatross-users at object-craft.com.au
>Subject: [albatross-users] Getting things *out* of session_vars?
>
>
>Hello,
>
>I am using sentinel values in my session_vars to check that a user has
>both completed a required form and that the user hasn't done something 
>silly, like press back.
>
>I am dutifully adding these values to session_vars, but when I test 
>from
>
>them on the next page, I can't find them and I am redirected back.  I
>think that I am looking in the wrong place.
>
>I am looking in ctx.locals.   Is there another place that I should be 
>looing for saved variables? ctx.session, perhaps?
>
>Thanks,
>
>VanL
>
>_______________________________________________
>Albatross-users mailing list Albatross-users at object-craft.com.au
>https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross-user
>s
>  
>





More information about the Albatross-users mailing list