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.