[web2py] Re: If statement in View not processing correctly

2016-04-08 Thread Jeff Riley
That is great Anthony and everyone else. Thank you very much for the fantastic help. On Friday, April 8, 2016 at 2:44:38 PM UTC-5, Jeff Riley wrote: > > Hello all. I have the following if statement in my views to try to > eliminate empty fields that are displaying "None" in my views. I am

[web2py] Re: If statement in View not processing correctly

2016-04-08 Thread Leonel Câmara
That's the ternary operator in Python by the way -- 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

[web2py] Re: If statement in View not processing correctly

2016-04-08 Thread Anthony
Sorry, it should have been: if not customer.address2: That will be True whenever customer.address2 is None or an empty string. Actually, there is an even better approach -- no need for an if/else block at all -- just use the following single line: Apt/Suite: {{=B(customer.address2) if

[web2py] Re: If statement in View not processing correctly

2016-04-08 Thread Jeff Riley
All thank you very much for the really fast responses. It turns out I had to use the "If customer.address2 is None:" statement. The "If customer.address2:" would not work for me. Again thank you all very much. On Friday, April 8, 2016 at 2:44:38 PM UTC-5, Jeff Riley wrote: > > Hello all. I

[web2py] Re: If statement in View not processing correctly

2016-04-08 Thread Anthony
None is a Python object, not a string value, so it would be: if customer.address2 is None: You could also do: if customer.address2: which will evaluate to False if the address is None or if it is an empty string (''). Anthony On Friday, April 8, 2016 at 3:44:38 PM UTC-4, Jeff Riley wrote:

[web2py] Re: If statement in View not processing correctly

2016-04-08 Thread Dave S
On Friday, April 8, 2016 at 12:44:38 PM UTC-7, Jeff Riley wrote: > > Hello all. I have the following if statement in my views to try to > eliminate empty fields that are displaying "None" in my views. I am not > sure how to get the field value to evaluate the statement. Any help >