I want to display *0* instead of *None* for the session.counter or session.wrong_counter in my app. I have tried about 10 different ways to do this but I am not getting it right for some reason.
This is the Controller for the page *score*: def score(): image = db.pic(request.args(0,cast=int)) or redirect(URL('index')) correct = image.id == session.pic_id next_game = random.randint(1, 35) wrong_counter = [] right_counter = [] if correct: session.counter = (session.counter or 0)+1 right_counter=session.counter if not correct: session.wrong_counter = (session.wrong_counter or 0)+1 wrong_counter=session.wrong_counter return locals() In the View I have {{=session.counter}} and {{=session.wrong_counter}}. When the page *score* first visited during the session one of them will display *1* and the other will display *None* depending on the correct or not correct conditions as expected, however, I want to display 0 instead of None. I would very much appreciate some help with this. -- 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.