<div dir="ltr">If I remember correctly kallithea explicitly handles commits, so probably it has no need for the transaction manager.<br>Try to add base_config['tm.enabled'] = False in app_cfg.py and see it everything still works as expected and the error disappeared.<div><br></div><div>Alessandro</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 31, 2016 at 2:15 PM, Thomas De Schampheleire <span dir="ltr"><<a href="mailto:patrickdepinguin@gmail.com" target="_blank">patrickdepinguin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Alessandro,<br>
<br>
In kallithea/lib/__init__.py you added following statements:<br>
<br>
from . import helpers<br>
from . import app_globals<br>
<br>
following an expectation of Turbogears2.<br>
This poses problems with statements like 'from kallithea.lib import vcs'.<br>
<br>
I have now dug deeper to the real requirement of this change, and<br>
found that it is due to method _setup_helpers_and_globals in<br>
tg/configuration/app_config.<wbr>py:<br>
<br>
def _setup_helpers_and_globals(<wbr>self, conf):<br>
"""Add helpers and globals objects to the ``conf``.<br>
<br>
Override this method to customize the way that ``app_globals``<br>
and ``helpers``<br>
are setup. TurboGears expects them to be available in ``conf``<br>
dictionary<br>
as ``tg.app_globals`` and ``helpers``.<br>
"""<br>
gclass = conf.pop('app_globals', None)<br>
if gclass is None:<br>
try:<br>
g = conf['package'].lib.app_<wbr>globals.Globals()<br>
except AttributeError:<br>
log.warn('app_globals not provided and<br>
lib.app_globals.Globals is not available.')<br>
g = Bunch()<br>
else:<br>
g = gclass()<br>
<br>
g.dotted_filename_finder = DottedFileNameFinder()<br>
conf['tg.app_globals'] = g<br>
<br>
if conf.get('tg.pylons_<wbr>compatible', True):<br>
conf['pylons.app_globals'] = g<br>
<br>
h = conf.get('helpers', None)<br>
if h is None:<br>
try:<br>
h = conf['package'].lib.helpers<br>
except AttributeError:<br>
log.warn('helpers not provided and lib.helpers is not<br>
available.')<br>
h = Bunch()<br>
conf['helpers'] = h<br>
<br>
<br>
Encouraged by the docstring, I tried overriding this method as follows<br>
from Kallithea:<br>
<br>
diff --git a/kallithea/config/app_cfg.py b/kallithea/config/app_cfg.py<br>
--- a/kallithea/config/app_cfg.py<br>
+++ b/kallithea/config/app_cfg.py<br>
@@ -33,6 +33,14 @@ class KallitheaAppConfig(AppConfig):<br>
def after_init_config(self, conf):<br>
conf['tg.strict_tmpl_context'] = True<br>
<br>
+ def _setup_helpers_and_globals(<wbr>self, conf):<br>
+ from kallithea.lib import app_globals, helpers<br>
+ from tg.util import DottedFileNameFinder<br>
+ g = app_globals.Globals()<br>
+ conf['tg.app_globals'] = g<br>
+ conf['pylons.app_globals'] = g<br>
+ conf['helpers'] = helpers<br>
+ g.dotted_filename_finder = DottedFileNameFinder()<br>
<br>
base_config = KallitheaAppConfig()<br>
base_config.renderers = []<br>
diff --git a/kallithea/lib/__init__.py b/kallithea/lib/__init__.py<br>
--- a/kallithea/lib/__init__.py<br>
+++ b/kallithea/lib/__init__.py<br>
@@ -24,9 +24,6 @@ Original author and date, and relevant c<br>
:copyright: (c) 2013 RhodeCode GmbH, and others.<br>
:license: GPLv3, see LICENSE.md for more details.<br>
"""<br>
-from . import helpers<br>
-from . import app_globals<br>
-<br>
import os<br>
<br>
def get_current_revision(quiet=<wbr>False):<br>
<br>
<br>
This seems to work functionally, also in the test suite, but for a<br>
reason unclear to me the above patch triggers debug logs of tg to<br>
appear on the console when running 'paster serve development.ini',<br>
while it is not the case without this patch.<br>
What worries me most, is that inside these extra logs, there is an<br>
error log as follows:<br>
<br>
2016-08-31 12:55:09.422 ERROR [tg.appwrappers.transaction_<wbr>manager]<br>
Unable to Enable Transaction Manager<br>
Traceback (most recent call last):<br>
File "/home/tdescham/repo/contrib/<wbr>kallithea/venv/kallithea-tg-<wbr>clean/lib/python2.7/site-<wbr>packages/tg/appwrappers/<wbr>transaction_manager.py",<br>
line 51, in __init__<br>
import transaction<br>
ImportError: No module named transaction<br>
2016-08-31 12:55:09.423 DEBUG [tg.appwrappers.transaction_<wbr>manager]<br>
TransactionManager enabled: False -> {'attempts': 1, 'enabled': True,<br>
'commit_veto': None}<br>
<br>
<br>
It is unclear to me whether this is a new problem due to my patch, or<br>
that it always existed but never showed due to the logs not visible.<br>
<br>
Any feedback is welcome...<br>
<br>
Thanks a lot,<br>
Thomas<br>
</blockquote></div><br></div>