On Mon, 2010-12-13 at 22:52 -0800, Mike Orr wrote:
> On Mon, Dec 13, 2010 at 8:11 PM, Chris McDonough <[email protected]> wrote:
> > On Mon, 2010-12-13 at 15:41 -0800, Mike Orr wrote:
> >> Where is the config object and everything in pshell?
> >>
> >> I want to see what's in config to see what I can print in a template
> >> and the syntax to get to it.
> >
> > "config" isn't a long-lived thing.  It is a wrapper for the registry
> > that dies once the process is "started" (or in the case of a pshell,
> > that dies once the interactive shell is runnning).  Only the registry is
> > available.
> >
> > But if you're in a pshell shell, you can recreate it:
> 
> OK, I asked the wrong question. I meant, how can I get my application
> settings, and the other internal configuration variables. In Pylons
> these are all stored in 'config' throughout the lifetime of the
> application, so I assumed Pyramid's 'config' was the same. My main
> reason for doing this is to see what all the variables are and how to
> access them (i.e., which are keys, which are nested keys, which are
> dotted keys, which are attributes, etc). I need my settings for
> various customizations, and at least in Pylons the internal variables
> sometimes come in useful at unexpected times. If ``request.settings``
> and ``request.registry`` are the easiest way to access these, I'll use
> that.

That stuff is always available in pshell via:

from pyramid.threadlocal import get_current_registry
settings = get_current_registry().settings

or, in a "real" webapp:

request.registry.settings

It's likely we should make registry a global in pshell for this purpose.

- C



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