changeset 6139:569feabd3c9d

utils: rename add_cache to setup_cache_regions Rename method 'add_cache' to something that better describes what it actually does.
author Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
date Sun, 21 Aug 2016 13:43:06 +0200
parents 0afdd2802a0a
children ee88c8c07111
files kallithea/lib/celerylib/tasks.py kallithea/lib/paster_commands/common.py kallithea/lib/utils.py kallithea/tests/scripts/manual_test_concurrency.py
diffstat 4 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/celerylib/tasks.py	Wed Aug 17 21:40:38 2016 +0200
+++ b/kallithea/lib/celerylib/tasks.py	Sun Aug 21 13:43:06 2016 +0200
@@ -44,7 +44,7 @@
     str2bool, __get_lockkey, LockHeld, DaemonLock, get_session
 from kallithea.lib.helpers import person
 from kallithea.lib.rcmail.smtp_mailer import SmtpMailer
-from kallithea.lib.utils import add_cache, action_logger
+from kallithea.lib.utils import setup_cache_regions, action_logger
 from kallithea.lib.vcs.utils import author_email
 from kallithea.lib.compat import json, OrderedDict
 from kallithea.lib.hooks import log_create_repository
@@ -52,7 +52,7 @@
 from kallithea.model.db import Statistics, Repository, User
 
 
-add_cache(config)  # pragma: no cover
+setup_cache_regions(config)  # pragma: no cover
 
 __all__ = ['whoosh_index', 'get_commits_stats', 'send_email']
 
--- a/kallithea/lib/paster_commands/common.py	Wed Aug 17 21:40:38 2016 +0200
+++ b/kallithea/lib/paster_commands/common.py	Sun Aug 21 13:43:06 2016 +0200
@@ -31,7 +31,7 @@
 import paste
 from paste.script.command import Command, BadCommand
 
-from kallithea.lib.utils import add_cache
+from kallithea.lib.utils import setup_cache_regions
 
 
 def ask_ok(prompt, retries=4, complaint='Yes or no please!'):
@@ -108,6 +108,6 @@
         from pylons import config
         from kallithea.model import init_model
         from kallithea.lib.utils2 import engine_from_config
-        add_cache(config)
+        setup_cache_regions(config)
         engine = engine_from_config(config, 'sqlalchemy.db1.')
         init_model(engine)
--- a/kallithea/lib/utils.py	Wed Aug 17 21:40:38 2016 +0200
+++ b/kallithea/lib/utils.py	Sun Aug 21 13:43:06 2016 +0200
@@ -747,7 +747,7 @@
 #===============================================================================
 
 # set cache regions for beaker so celery can utilise it
-def add_cache(settings):
+def setup_cache_regions(settings):
     cache_settings = {'regions': None}
     for key in settings.keys():
         for prefix in ['beaker.cache.', 'cache.']:
--- a/kallithea/tests/scripts/manual_test_concurrency.py	Wed Aug 17 21:40:38 2016 +0200
+++ b/kallithea/tests/scripts/manual_test_concurrency.py	Sun Aug 21 13:43:06 2016 +0200
@@ -38,7 +38,7 @@
 from paste.deploy import appconfig
 from sqlalchemy import engine_from_config
 
-from kallithea.lib.utils import add_cache
+from kallithea.lib.utils import setup_cache_regions
 from kallithea.model import init_model
 from kallithea.model import meta
 from kallithea.model.db import User, Repository, Ui
@@ -51,7 +51,7 @@
 conf = appconfig('config:development.ini', relative_to=rel_path)
 load_environment(conf.global_conf, conf.local_conf)
 
-add_cache(conf)
+setup_cache_regions(conf)
 
 USER = TEST_USER_ADMIN_LOGIN
 PASS = TEST_USER_ADMIN_PASS