On 29.01.2013, at 09:24, Andreas Jung <[email protected]> wrote: > 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?
Within main() you usually have a config object that has a get_settings() method. You should almost never use pyramid.threadlocal.get_current_registry() in application code if there's another way to get the registry (such as e.g. request.registry in a view). Also see http://docs.pylonsproject.org/projects/pyramid/en/latest/api/threadlocal.html#pyramid.threadlocal.get_current_registry. HTH, Andreas -- 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.
