It's pretty rare that you need begin() during config-time of your app. It pushes threadlocals on the stack so that certain APIs like asset lookups and renderers can access your config. This is almost never necessary but you managed to find a case where it matters in using translation_dirs.
The times where this is mostly useful are in testing, but here it is done automatically for you via p.testing.setUp(). If you don't call end() there will be a memory leak as your config will be pushed onto the main thread forever. - Michael On Fri, Nov 6, 2015 at 9:50 AM, Piotr Dobrogost < [email protected]> wrote: > Hi! > > I had problem reproducing behavior from a project in simple snippet ( > https://groups.google.com/forum/#!topic/pylons-discuss/BwuQsirXZlM) and > the reason for the difference was that in the snippet config.begin() was > not called – https://gist.github.com/piotr-dobrogost/968f99c96d9aa0d1b2e4 > > When and why should config.begin() be called? > > Regards, > Piotr Dobrogost > > ps. > After reading description of .begin() in docs I'm none the wiser: > "Indicate that application or test configuration has begun. This pushes a > dictionary containing the application registry > <http://docs.pylonsproject.org/projects/pyramid/en/latest/glossary.html#term-application-registry> > implied by registry attribute of this configurator and the request > <http://docs.pylonsproject.org/projects/pyramid/en/latest/glossary.html#term-request> > implied by the request argument onto the thread local > <http://docs.pylonsproject.org/projects/pyramid/en/latest/glossary.html#term-thread-local> > stack consulted by various pyramid.threadlocal > <http://docs.pylonsproject.org/projects/pyramid/en/latest/api/threadlocal.html#module-pyramid.threadlocal> > API functions." > > -- > 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. > 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 http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
