So, when setting up a Pyramid app we instantiate a Configurator.
One we're handling requests, we have a registry.
If I have some arbitrary config read from a file at the same time as I'm
instantiating the Configurator, where should I put it?
(thinks of these as application globals, etc)
Is the configurator instance available when handling requests? If so,
what's the correct API?
Can the registry be used for simple key value pairs or is it only for
component registrations?
cheers,
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
The configurator is a mostly-stateless wrapper for the registry. You
can recreate *a* configurator via:
config = Configurator(registry=request.registry)
But it's not really possible to store data on "the" configurator because
it's thrown out after startup-time configuration.
You'll want to store state on (or in) the registry instead.
> Can the registry be used for simple key value pairs or is it only for
> component registrations?
pyramid.registry.Registry (the default registry type) indeed supports
registry['foo'] = 'bar'. You can also just do registry.foo = 'bar'.
We're all adults here ;)
- C
Really doesn't matter. If you ever intend to use a "bare" ZCA registry
(e.g. you want to share a registry with like Zope or something), it
doesn't have __getitem__ or __setitem__, but if you never intend to use
one, it's fine to use these.
- C
>
>
> --
> 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/-/lYZ6TaMXlIMJ.
> To post to this group, send email to pylons-...@googlegroups.com.
> To unsubscribe from this group, send email to pylons-discuss
> +unsub...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.