[albatross-users] States... how to go around...
skytteren at netcom.no
skytteren at netcom.no
Wed Nov 5 08:23:51 EST 2003
Hi!!!
I got a problem with "going around" mye albatross webpage.
The problem i quite simple:
I go into one page, does something and are sent to another page...
Of course, I did something wrong and wants to go back with my "Back"
button in my browser. It looks like I go back, but the server gives me
all the functinality of the second page (it looks like I'm still in the
second page, but se the first page)... What do i need to do to get this
working proparly...
I use :
class AppContext(SessionAppContext):
def __init__(self, app):
SessionAppContext.__init__(self, app)
and py_mod's!
There's also another problem:
How do i know what Node class I've "clicked" in a al-tree???
Here is som of the code that I find relevant:
def page_enter(ctx):
ctx.locals.debug = ""
ctx.add_session_vars('debug')
if ctx.locals.debug == "":
e = Exercise()
ctx.locals.exercise = e
ctx.add_session_vars('exercise')
def page_process(ctx):
if ctx.req_equals('cancel'):
ctx.locals.creating_exercise = False
ctx.set_page('main')
elif ctx.req_equals('create_problem'):
ctx.locals.exercise_problemset = get_problemset
(ctx.locals.exercise, ctx.locals.create_problem, ctx)
if ctx.locals.exercise_problemset != None:
ctx.locals.problemstate='exercise'
ctx.add_session_vars('problemstate')
ctx.add_session_vars('exercise_problemset')
ctx.set_page('problem_creation')
elif ctx.req_equals('insert_problem'):
ctx.locals.exercise_problemset = get_problemset
(ctx.locals.exercise, ctx.locals.insert_problem, ctx)
if ctx.locals.exercise_problemset != None:
ctx.locals.creating_exercise = True
ctx.add_session_vars('exercise_problemset')
ctx.add_session_vars('creating_exercise')
ctx.set_page('problems')
elif ctx.req_equals('remove_problem'):
pass
#elif ctx.req_equals('edit'):
elif ctx.req_equals('insert_composite_problem'):
ctx.locals.exercise_problemset = get_problemset
(ctx.locals.exercise, ctx.locals.insert_composite_problem, ctx)
if ctx.locals.exercise_problemset != None:
ps = ProblemSet()
ctx.locals.exercise_problemset.children.append(ps)
def get_problemset(problemset, problemsetid, ctx):
ctx.locals.debug += "Problemset: " + str(problemset)
ctx.locals.debug += "ProblemsetID: " + problemsetid
if str(problemset) == problemsetid and problemset.type != 'p':
return problemset
elif problemset.type != 'p':
for ps in problemset.children:
potensiell = get_problemset(ps, problemsetid, ctx)
if potensiell is not None:
return potensiell
else:
return None
<al-tree iter="node" expr="exercise" >
....
<al-a expr="'create_problem=%s' % node.value()">Create problem</al-
a> 
<al-a expr="'insert_problem=%s' % node.value()">Insert problem</al-
a> 
<al-a expr="'insert_composite_problem=%s' % node.value()">Insert
composite problem</al-a>
....
</al-tree>
If there are anyone that know how to solv these problems or now where I
can look please help me.. :)
Stein K. Skytteren
Trondheim, Norway
More information about the Albatross-users
mailing list