On Mon, 2010-12-13 at 16:36 -0800, Mike Orr wrote:
> On Mon, Dec 13, 2010 at 3:41 PM, Mike Orr <[email protected]> wrote:
> > Where is the config object and everything in pshell?
> >
> > $ paster shell development.ini MyApp
> > ...
> > "root" is the Pyramid app root object.
> >>>> config
> > NameError: name 'config' is not defined
> >>>> dir()
> > ['__builtins__', 'root']
> >>>> dir(root)
> > ['__doc__', '__init__', '__module__', '__name__', '__parent__']
> >>>> sorted(root.keys())
> > AttributeError: DefaultRootFactory instance has no attribute 'keys'
> >>>> import pyramid.configuration
> >>>> help(pyramid.configuration)
> > # No 'get_config()' function or such listed.
> >
> > I want to see what's in config to see what I can print in a template
> > and the syntax to get to it.

Not sure how those two things relate, but "how to create a config" is
hopefully answered by the previous email I sent.

> Erm, how do I get the config in a view?
> 
> def Admin(_Handler):
>     def error(self):
>         raise RuntimeError("intentional")
> 
> In the interactive traceback:
> 
> >>> self.request.config
> AttributeError: 'Request' object has no attribute 'config'
> >>> dir(self.request)
> # Nothing useful
> >>> sorted(self.request.keys())
> # These are the same as the ``request.environ`` keys.

Configurator(request.registry) (may not exist in a pshell)

or

from pyramid.configuration import Configurator
Configurator(get_current_registry(), package='mypackagename')

- 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