Mercurial > kallithea
changeset 7847:a38e05a0c79e
tg2: handle cache_dir configuration jumping around between TurboGears versions
Tweak 87672c1916f8 - the use of 'tg.cache_dir' turns out to not be a good idea.
TurboGears 2.4 moved 'cache_dir' configuration to the expected 'cache_dir' key,
and no longer has 'tg.cache_dir' ... and also not the old
'app_conf'.'cache_dir' .
Just try both locations.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Wed, 28 Aug 2019 12:28:01 +0200 |
parents | d68b77e4e4ab |
children | 5e4afc5fd29e |
files | kallithea/lib/celerylib/__init__.py kallithea/lib/celerylib/tasks.py |
diffstat | 2 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/celerylib/__init__.py Wed Aug 28 12:07:37 2019 +0200 +++ b/kallithea/lib/celerylib/__init__.py Wed Aug 28 12:28:01 2019 +0200 @@ -102,7 +102,7 @@ def locked_task(func): def __wrapper(func, *fargs, **fkwargs): lockkey = __get_lockkey(func, *fargs, **fkwargs) - lockkey_path = config['tg.cache_dir'] # The configured cache_dir is only available under this name ... + lockkey_path = config.get('cache_dir') or config['app_conf']['cache_dir'] # Backward compatibility for TurboGears < 2.4 log.info('running task with lockkey %s', lockkey) try:
--- a/kallithea/lib/celerylib/tasks.py Wed Aug 28 12:07:37 2019 +0200 +++ b/kallithea/lib/celerylib/tasks.py Wed Aug 28 12:28:01 2019 +0200 @@ -73,7 +73,7 @@ DBS = celerylib.get_session() lockkey = celerylib.__get_lockkey('get_commits_stats', repo_name, ts_min_y, ts_max_y) - lockkey_path = config['tg.cache_dir'] # The configured cache_dir is only available under this name ... + lockkey_path = config.get('cache_dir') or config['app_conf']['cache_dir'] # Backward compatibility for TurboGears < 2.4 log.info('running task with lockkey %s', lockkey)