Thanks Michael! You are talking about these two lines of code <https://github.com/Pylons/pyramid-cookiecutter-alchemy/blob/c84ab5bff19d6fbef9e36295cf3f74199b7a9a50/%7B%7Bcookiecutter.repo_name%7D%7D/%7B%7Bcookiecutter.repo_name%7D%7D/models/__init__.py#L59-L60> in the cookiecutter’s model/__init__.py, correct?
settings = config.get_settings() settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager' That manager hook allocates its own explicit transaction manager (see code <https://github.com/Pylons/pyramid_tm/blob/master/pyramid_tm/__init__.py#L179-L188>) instead of using the transaction.manager default, as you’ve mentioned. Using that manager hook I can then derive from an explicit manager and extend with custom functionality—and that would be the recommended way of doing so? That may help me solve a question I just asked at the transaction Github repo (see issue #62 <https://github.com/zopefoundation/transaction/issues/62> there). On Sunday, September 2, 2018 at 9:04:58 AM UTC+10, Michael Merickel wrote: > > Jens, by default your example is true, but it is not true in the > cookiecutter configuration. The value of request.tm is defined by the > tm.manager_hook setting and by default it is the threadlocal > transaction.manager. The cookiecutter overrides the hook (and I suggest you > do as well) to define a non-threadlocal manager configured in explicit=True > mode which will help weed out bugs accessing transactions after they have > been committed. I strongly suggest any code you write that needs the tm > should use request.tm, not transaction.manager - as the former is > configurable. > > - Michael > -- 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 pylons-discuss+unsubscr...@googlegroups.com. To post to this group, send email to pylons-discuss@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/0f690504-4a20-42c7-a10e-0da915e602b3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.