Hi

I am new to python and web2py. I have a small sqlite table of "career test" 
questions that i need to be presented to a user in form of a quiz, one 
question appearing at a time
Problems:
1. I can't figure out how to safely stop at the last record, it breaks and 
after 3 more clicks, it takes me to "None" white page.
2. I need to capture each instance of the quiz for a specific user without 
them login in, how do i collect the questions with a session identifier?

Below is my code:

def career():
    q = db().select(db.quest.ALL, orderby=db.quest.q_id)
    answerForm = SQLFORM(db.quiz)
    while True:
        while not form.process().accepted:
            session.counter = len(q)-1
            question = q[session.counter]['q_id']
            return dict(question=question, answerForm=answerForm)
        else:
            session.counter -= 1
            question = q[session.counter]['q_id']
        if session.counter < 0:
            question = q[0]['q_id']
        return dict(question=question, answerForm=answerForm)



Any ideas on a better approach asap will be highly appreciated.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to