Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread Mark Graves
It appears that auth.settings.create_user_groups takes either False or the string that formats the user group creation message. So you'll need to provide a string format representation ie '%(id)s' as is shown in the error. However that won't convert to a boolean, so your cast function will fail.

Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread Mark Graves
Also: auth.settings.create_user_groups = myconf.take('auth.create_user_groups', cast=lambda value: bool(int(value))) On Thu, Nov 19, 2015 at 10:53 PM, Mark Graves wrote: > Can you reproduce this error in a fresh welcome app? > > Then you can send just the one line? > > Is it solely: > > ; aut

Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread Mark Graves
Can you reproduce this error in a fresh welcome app? Then you can send just the one line? Is it solely: ; auth [auth] create_user_groups = 1 VS ; auth [auth] create_user_groups = 0 ? On Thu, Nov 19, 2015 at 10:44 PM, 黄祥 wrote: > pardon, i just tried, what is discussed in this thread on m

Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread 黄祥
pardon, i just tried, what is discussed in this thread on my configuration, parsing as string .'auth.create_user_groups' not auth.create_user_groups as a variable e.g. models/db.py auth.settings.create_user_groups = False i want to change the configuration into privates/appconfig.ini with : e.g.

Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread Mark Graves
I just tried to reproduce your error and could not. Judging from the error, are you sure you are passing in the string 'auth.create_user_groups' and not auth.create_user_groups as a variable? On Thu, Nov 19, 2015 at 9:32 PM, 黄祥 wrote: > tested it. return an error if i put the value int = 1 as

Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread 黄祥
tested it. return an error if i put the value int = 1 as true in appconfig.ini e.g. privates/appconfig.ini [auth] create_user_groups = 0 ; return an error traceback when value = 1, when value = 0, no error occured, works as expected models/db.py auth.settings.create_user_groups = myconf.take('au

Re: [web2py] Re: Appconfig cast boolean

2015-08-13 Thread Mark Graves
Set migrate = (Empty string) => False > On Aug 13, 2015, at 8:58 AM, ermolaev.icrea...@gmail.com wrote: > > I talk about it! > > If in .ini file: > > migrate = False > > it conderted to string too and is True in python code! > > понедельник, 3 августа 2015 г., 3:51:52 UTC+3 пользователь Mar

[web2py] Re: Appconfig cast boolean

2015-08-13 Thread ermolaev . icreator
I talk about it! If in .ini file: migrate = False it conderted to string too and is True in python code! понедельник, 3 августа 2015 г., 3:51:52 UTC+3 пользователь Mark Graves написал: > > What is the proper syntax for appconfig.ini if the cast is a boolean. > > With a fresh install of web2py

[web2py] Re: Appconfig cast boolean

2015-08-10 Thread Massimo Di Pierro
That that should be correct. On Sunday, 9 August 2015 11:26:36 UTC-5, Mark Graves wrote: > > 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) > > pri

[web2py] Re: Appconfig cast boolean

2015-08-09 Thread Mark Graves
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

[web2py] Re: Appconfig cast boolean

2015-08-03 Thread 黄祥
nice, it seems we lack of it in the scaffolding app. (in private.ini there is a migrate value yet in the db.py not have) best regards, stifan On Monday, August 3, 2015 at 6:22:09 PM UTC+7, Anthony wrote: > > Therefore: > > mc = myconf.take('db.migrate',cast=lambda value: bool(int(value))) > > An

[web2py] Re: Appconfig cast boolean

2015-08-03 Thread Mark Graves
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

[web2py] Re: Appconfig cast boolean

2015-08-03 Thread Anthony
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] Re: Appconfig cast boolean

2015-08-03 Thread Leonel Câmara
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 th