Configuration variables

0 views
Skip to first unread message

Kless

unread,
May 5, 2009, 7:01:56 AM5/5/09
to glashammer
To add configuration variables, are the same the next sentences?


* app.add_config_var('foo/bar', str, bar)
* app.foo_bar = bar

Ali Afshar

unread,
May 5, 2009, 7:21:43 AM5/5/09
to glash...@googlegroups.com
Hi,

They are not the same thing at all. it is important to remember that the
add_config_var call only adds the availability of that config variable,
and sets it to the default.

To access the variable later you can use app.cfg['bar'].

Ali

Kless

unread,
May 5, 2009, 7:45:01 AM5/5/09
to glashammer
app.cfg['bar'] or app.conf['bar'] ?

because here [1] it's run with app.conf:

I also have seen in some code using get_app().conf['bar'] [2]. When is
used get_app().conf ?


[1] http://glashammer.org/config.html#reading-configuration-variables

[2] http://glashammer.org/api_util_local.html#module-glashammer.utils.local
Reply all
Reply to author
Forward
0 new messages