On Thursday, January 17, 2013 9:11:51 AM UTC-8, Chris McDonough wrote:
>
> On Thu, 2013-01-17 at 09:04 -0800, Wyatt Baldwin wrote: 
> > On Thursday, January 17, 2013 3:25:15 AM UTC-8, Andreas Jung wrote: 
> >         I added some extra app specific sections to the ini file of 
> >         my Pyramid application. How can I get hold of the settings 
> >         from within my app (pyramid.config)? 
> > 
> > Pyramid doesn't automatically parse settings. You can use the 
> > `pyramid.paster.get_appsettings(config_uri, name=None)` function to 
> > get at them. 
> > 
> > Reference: 
> > 
> http://docs.pylonsproject.org/projects/pyramid/en/latest/api/paster.html#pyramid.paster.get_appsettings
>  
>
>
> Fraid all the answers I've seen so far are incorrect. 
>
> Pyramid doesn't know beans about sections other than the "app" secrion 
> in the config file.  You'll need to use ConfigParser to parse the config 
> file again within your app. 
>
 
My suggestion will work, as long as the section looks like a normal app 
section:

[app:mysettings]
use = call:my.package:no_op
a = 1
b = 2

Where the `no_op` function would look like this:

    def no_op(global_config, **settings): pass

To me, that's a lot easier than manually using ConfigParser.


-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/HZjq6fCwMkAJ.
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