On Tuesday, January 29, 2013 12:24:53 AM UTC-8, Andreas Jung wrote:
>
> -----BEGIN PGP SIGNED MESSAGE----- 
> Hash: SHA1 
>
> I have a method 
>
> def notify(text): 
>     settings = pyramid.threadlocal.get_current_registry().settings 
>     host = settings.get(....) 
>
> which works fine when called from a view. 
>
> However when I call this method during the startup phase 
> from the main() method of my app then 'settings' evaluates to None. 
>
> I have seen that my code is working also during the startup phase 
> with Kotti but not within a bare Pyramid application...any trick 
> I am missing? 
>

You probably don't want to use thread locals for this. Can you just pass 
the relevant settings to the function?

If you really want to use thread locals, you could push the config's 
registry onto the thread local stack in main() before you call notify(). 

-- 
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 http://groups.google.com/group/pylons-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to