Thanks Anthony, I changed the View as per your answer. This was the
easiest solution. It works great, I appreciate it. *(you forgot to take out
one of the parenthesis at the end but I removed it)*
On Friday, July 24, 2015 at 8:51:33 PM UTC+8, Anthony wrote:
>
> Well, the code checks two conditions, correct and not correct, and only
> one of those is true on any given request. Yet you only set the value of
> one of your session variables within each condition -- so of course the one
> you don't set is None (it is actually undefined, but the session object is
> a Storage object, which returns None for any requested attribute that
> doesn't exist). Outside of the conditional logic, you could do something
> like:
>
> session.counter = 0 if session.counter is None else session.counter
>
> Alternatively, you could move that to the view:
>
> {{=0 if session.counter is None else session.counter)}}
>
> Anthony
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.