Anthony answered this question but I will rephrase: if not start2 is None: end2 cannot be empty if not start1 is None and not end1 is None and not start 2 is None: end2 cannot be smaller then start2, except if value 0:00 is inserted
On Friday, 14 October 2016 06:58:17 UTC-5, Yebach wrote: > > But how to distinguish between empty entry and a value of midnight? > > In my case i have a form with start1, end1 and start2 and end2: > if start2 exists. > end2 cannot be empty > if start1 and end1 and start 2 exist: > end2 cannot be smaller then start2, except if value 0:00 is inserted > > Hope it is clear > > On Friday, October 14, 2016 at 1:40:42 PM UTC+2, Anthony wrote: >> >> It does not behave as None but as False (so you can actually test to see >> if it is None). For details, see https://bugs.python.org/issue13936. At >> the end of that issue discussion, you will not it was closed with a commit >> that changed the behavior in Python 3.5 (in 3.5, time(0, 0) evaluates to >> True). If you are trying to determine if the relevant value is None, just >> test for that explicitly: >> >> if time_or_none is not None: >> do_something_with(time_or_none) >> >> Anthony >> >> On Friday, October 14, 2016 at 5:07:16 AM UTC-4, Yebach wrote: >>> >>> Hello >>> >>> I have a datetime field in db. If I set time to 0:00 - datetime.time(0, >>> 0) the if statement behaves as variable is None >>> >>> Any ideas why? >>> >> -- 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.