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

VanL vlindberg at verio.net
Wed Apr 23 11:41:54 EST 2003


Hello,

Michael C. Neel wrote:

>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 neglected to say this, but for most vars I *am* doing this on 
page_enter.  The problem occurs on the next page:

[Previous code here]
[Passes all validation checks]
[add session vars]
ctx.set_page('nextpage')

On the nextpage

def page_process(ctx):
    if not hasattr(ctx.locals, 'var_set_on_previous_page'):
        # Var set on previous page is not here.  Bounce back
        ctx.set_page('prevpage')

I keep on getting bounced back to prevpage, which makes me think that 
the session vars aren't in ctx.locals.  Hence my original question, how 
do I get stuff out of session_vars?

On a related note, I do have a page_enter function

def page_enter(ctx):
    # Initialization here
    if not hasattr(ctx.locals, somevar): setattr(ctx.locals, 'somevar', '')

However, I have to call this function manually, in page_display:

def page_display(ctx):
    page_enter(ctx)
    [continue]
   
Is that right?  I got the impression that a function of that name would 
be called automagically.
I am using mod_python 2.78, albatross 1.01, python2.2, apache 1.3-recent 
something.  This is a ModularSessionFileApp.


VanL






More information about the Albatross-users mailing list