On Aug 19, 11:23 am, Ryan <[email protected]> wrote:
> I'm utilizing my various environment .ini files to set application
> configuration where the config in question differs from env to env
> (e.g. Authorize.net testing server vs. production).
>
> In the case of something like a Twitter OAuth URL or the address all
> of the app's email communication should be sent from, it's the same
> regardless of all environments. What's the Pylons way for setting and
> accessing this kind of application config?

Something like this might work for you:

# base.ini ----------
[DEFAULT]
a = 1
b = 2
email_address = [email protected]

[app:main]
some = 1
defaults = 2


# development.ini ----------
[app:main]
use = config:base.ini
a = one
some = 4
defaults = 11ty
extra_value = w00t!


development.ini's [app:main] section will override and extend
base.ini's [app:main] section. Also, the values from base.ini's
[DEFAULT] section will end up in `config` when you use
development.ini. Further, development.ini's [app:main] section will
override base.ini's [DEFAULT] section, but you can still access the
original [DEFAULT] values via `config.global_conf`

If you also define a [DEFAULT] section in development.ini, you might
not get what you expect: it will *extend* base.ini's [DEFAULT] section
but won't *override* existing values.

The other related issue I've run into is with logging sections. For
example, if I want to create a couple different development-oriented
config files that share the same logging config, I'm not sure how to
do that without doing a copy/pasta. It seems that logging sections are
read only from the specific file you name on the command line when
running one of the `paster` commands.

Hope that helps! ;)

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to