On Sat, 2011-02-12 at 09:43 -0800, Mike Orr wrote:
> On Wed, Feb 9, 2011 at 2:46 PM, Tres Seaver <tsea...@palladion.com> wrote:
> > One bit I noticed: In
> > https://bytebucket.org/sluggo/pyramid-docs/wiki/html/migration.html#app-globals-and-cache,
> > you state::
> >
> >  You can also use ordinary module globals or class attributes,
> >  provided you don’t run multiple instances of Pyramid applications in
> >  the same process. (Pyramid does not encourage multiple applications
> >  per process anyway. Instead Pyramid recommends its extensibility
> >  features such as its Zope Component Architecture, which allow you to
> >  write pieces of code to interfaces and plug them into a single
> >  application.)
> >
> > Pyramid actually goes out of its way to make running multiple apps in
> > the same process work:  in fact, it uses the ZCA in a way which means
> > that registrations made in one app's configurator won't interfere with
> > those made in another app's configurator.  Perhaps the docs need to show
> > an example of such a setup, but it is quite supported.
> >
> > Some of us *do* write apps that expect to be extended / reconfigured via
> > the ZCA registry, but Pyramid itself doesn't mandate that (or even
> > document it all that well).  If such an app uses the "global" ZCA APIs,
> > it won't benefit from Pyramid's segregated registries, but that is no
> > different from use of any other global (module- or class-scope
> > variables, etc.)
> 
> I just got back from my trip. So what's the official recommendation
> for arbitrary global variables? I just wrote what I thought would be
> safe. But people have their database connections and other things
> they'll have to put somewhere. Should I say to put them all in the
> registry? Under Settings? As module globals?

I've been suggesting that folks put them in registry.settings.

> 
> If they do want to put something into the registry, what's the syntax?

It's the ZCA API.  I wouldn't suggest that folks use it to store simple
application-scoped values.

> Can you just assign an attribute in 'registry'?

You can do this as well, although if you assign the "wrong" value it may
break the system.  Better to use settings.

- C


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

Reply via email to