And, sanity check here, I can also do the following, correct:

[db] 

uri       = sqlite://storage.sqlite 
migrate   = 

myconf = AppConfig()

mc = myconf.take('db.migrate',cast=bool)

print mc
print type(mc)

Which should yield False, Boolean




On Monday, August 3, 2015 at 9:09:37 AM UTC-5, Mark Graves wrote:
>
> Should've thought of that.
>
> Nice to confirm intended behavior.
>
> I guess I could have done bool(mc) = myconf.take('db.migrate',cast = int)
>
> On Monday, August 3, 2015 at 6:22:09 AM UTC-5, Anthony wrote:
>>
>> Therefore:
>>
>> mc = myconf.take('db.migrate',cast=lambda value: bool(int(value)))
>>
>> Anthony
>>
>> On Monday, August 3, 2015 at 7:08:00 AM UTC-4, Leonel Câmara wrote:
>>>
>>> Well you're casting a string so any non-empty string is True. You have 
>>> to cast to an int.
>>>
>>

-- 
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.

Reply via email to