How about before returning config.make_wsgi_app() you do the work, stuff it 
into config.registry.settings, then add a new request method on request that 
you call with:

request.get_data()

that simply pulls it from request.registry.settings.

Now it’s all in one place, safe and sound, and you only process it once, upon 
application startup.

Bert

> On Mar 1, 2016, at 19:28, Jonathan Vanasco <[email protected]> wrote:
> 
> I have a bit of code that generates a few lists based on data in the active 
> `.ini`
> 
> These lists will never change for the lifetime of the process.
> 
> Right now I'm just hitting request.registry.settings on every request - but 
> this just makes me feel like I'm being lazy.
> 
> Is there a good place to just parse this stuff into structured data once?  
> I'm thinking the ApplicationCreated event would be good -- then I could 
> either stash it in the registry or a global namespace.  Does that sound okay?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to