diff --git a/kallithea/bin/kallithea_cli_base.py b/kallithea/bin/kallithea_cli_base.py --- a/kallithea/bin/kallithea_cli_base.py +++ b/kallithea/bin/kallithea_cli_base.py @@ -75,7 +75,6 @@ def register_command(config_file=False, logging.config.fileConfig(io.StringIO(config_string)) if config_file_initialize_app: kallithea.config.middleware.make_app_without_logging(kallithea.CONFIG.global_conf, **kallithea.CONFIG.local_conf) - kallithea.lib.utils.setup_cache_regions(kallithea.CONFIG) return annotated(*args, **kwargs) return cli_command(runtime_wrapper) return annotator diff --git a/kallithea/lib/hooks.py b/kallithea/lib/hooks.py --- a/kallithea/lib/hooks.py +++ b/kallithea/lib/hooks.py @@ -303,7 +303,6 @@ def _hook_environment(repo_path): """ import paste.deploy import kallithea.config.middleware - import kallithea.lib.utils extras = get_hook_environment() @@ -311,7 +310,6 @@ def _hook_environment(repo_path): kallithea.CONFIG = paste.deploy.appconfig('config:' + path_to_ini_file) #logging.config.fileConfig(ini_file_path) # Note: we are in a different process - don't use configured logging kallithea.config.middleware.make_app_without_logging(kallithea.CONFIG.global_conf, **kallithea.CONFIG.local_conf) - kallithea.lib.utils.setup_cache_regions(kallithea.CONFIG) repo_path = safe_unicode(repo_path) # fix if it's not a bare repo diff --git a/kallithea/lib/utils.py b/kallithea/lib/utils.py --- a/kallithea/lib/utils.py +++ b/kallithea/lib/utils.py @@ -33,10 +33,9 @@ import sys import traceback from distutils.version import StrictVersion -import beaker +import beaker.cache import mercurial.config import mercurial.ui -from beaker.cache import _cache_decorate from tg.i18n import ugettext as _ import kallithea.config.conf @@ -622,36 +621,6 @@ def check_git_version(): # CACHE RELATED METHODS #=============================================================================== -# set cache regions for beaker so celery can utilise it -def setup_cache_regions(settings): - # Create dict with just beaker cache configs with prefix stripped - cache_settings = {'regions': None} - prefix = 'beaker.cache.' - for key in settings: - if key.startswith(prefix): - name = key[len(prefix):] - cache_settings[name] = settings[key] - # Find all regions, apply defaults, and apply to beaker - if cache_settings['regions']: - for region in cache_settings['regions'].split(','): - region = region.strip() - prefix = region + '.' - region_settings = {} - for key in cache_settings: - if key.startswith(prefix): - name = key[len(prefix):] - region_settings[name] = cache_settings[key] - region_settings.setdefault('expire', - cache_settings.get('expire', '60')) - region_settings.setdefault('lock_dir', - cache_settings.get('lock_dir')) - region_settings.setdefault('data_dir', - cache_settings.get('data_dir')) - region_settings.setdefault('type', - cache_settings.get('type', 'memory')) - beaker.cache.cache_regions[region] = region_settings - - def conditional_cache(region, prefix, condition, func): """ @@ -674,6 +643,6 @@ def conditional_cache(region, prefix, co if condition: log.debug('conditional_cache: True, wrapping call of ' 'func: %s into %s region cache' % (region, func)) - wrapped = _cache_decorate((prefix,), None, None, region)(func) + wrapped = beaker.cache._cache_decorate((prefix,), None, None, region)(func) return wrapped diff --git a/kallithea/tests/scripts/manual_test_concurrency.py b/kallithea/tests/scripts/manual_test_concurrency.py --- a/kallithea/tests/scripts/manual_test_concurrency.py +++ b/kallithea/tests/scripts/manual_test_concurrency.py @@ -41,7 +41,6 @@ from sqlalchemy import engine_from_confi from kallithea.config.environment import load_environment from kallithea.lib.auth import get_crypt_password -from kallithea.lib.utils import setup_cache_regions from kallithea.model import meta from kallithea.model.base import init_model from kallithea.model.db import Repository, Ui, User @@ -52,8 +51,6 @@ rel_path = dirname(dirname(dirname(dirna conf = appconfig('config:development.ini', relative_to=rel_path) load_environment(conf.global_conf, conf.local_conf) -setup_cache_regions(conf) - USER = TEST_USER_ADMIN_LOGIN PASS = TEST_USER_ADMIN_PASS HOST = 'server.local'