None is in the URL vars.
http://127.0.0.1:8000/ES3/default/add_new_meeting_segment?
specificAddressID=None
how to handle None in conditional code in controller? Tried this:
if request.get_vars.specificAddressID == None: #if user did not select
an address then there is no FK to a db.Address record
specificAddressSuperObjectID = db(db.Address.address_title ==
'Unknown').select(db.Address.super_object_fk, limitby =
(0,1)).first().super_object_fk
else:
specificAddress = db.Address(request.get_vars.specificAddressID)
specificAddressSuperObjectID = specificAddress.super_object_fk
but receive error NoneType' object has no attribute 'super_object_fk'
if request.get_vars.specificAddressID == None: #if user did not select an
address then there is no FK to a db.Address record
specificAddressSuperObjectID = db(db.Address.address_title ==
'Unknown').select(db.Address.super_object_fk, limitby =
(0,1)).first().super_object_fk
else:
specificAddress = db.Address(request.get_vars.specificAddressID)
specificAddressSuperObjectID = specificAddress.super_object_fk
Why does the conditional IF line abive not handle the None condition? if
request.get_vars.specificAddressID == None:
If user enters data in date field, works fine, but I want to be able to
handle cases when user does not input anything.
thanks
Alex Glaros
--
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.