comparison rhodecode/lib/base.py @ 3693:6843cabe9925 beta

removed duplicated logic of how we invalidate caches for repos
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 03 Apr 2013 02:35:01 +0200
parents b66fd6de093c
children 1e5bb8ed77d6
comparison
equal deleted inserted replaced
3692:5f9f4ece4b52 3693:6843cabe9925
19 19
20 from rhodecode.lib.utils2 import str2bool, safe_unicode, AttributeDict,\ 20 from rhodecode.lib.utils2 import str2bool, safe_unicode, AttributeDict,\
21 safe_str, safe_int 21 safe_str, safe_int
22 from rhodecode.lib.auth import AuthUser, get_container_username, authfunc,\ 22 from rhodecode.lib.auth import AuthUser, get_container_username, authfunc,\
23 HasPermissionAnyMiddleware, CookieStoreWrapper 23 HasPermissionAnyMiddleware, CookieStoreWrapper
24 from rhodecode.lib.utils import get_repo_slug, invalidate_cache 24 from rhodecode.lib.utils import get_repo_slug
25 from rhodecode.model import meta 25 from rhodecode.model import meta
26 26
27 from rhodecode.model.db import Repository, RhodeCodeUi, User, RhodeCodeSetting 27 from rhodecode.model.db import Repository, RhodeCodeUi, User, RhodeCodeSetting
28 from rhodecode.model.notification import NotificationModel 28 from rhodecode.model.notification import NotificationModel
29 from rhodecode.model.scm import ScmModel 29 from rhodecode.model.scm import ScmModel
147 """ 147 """
148 Set's cache for this repository for invalidation on next access 148 Set's cache for this repository for invalidation on next access
149 149
150 :param repo_name: full repo name, also a cache key 150 :param repo_name: full repo name, also a cache key
151 """ 151 """
152 invalidate_cache('get_repo_cached_%s' % repo_name) 152 ScmModel().mark_for_invalidation(repo_name)
153 153
154 def _check_permission(self, action, user, repo_name, ip_addr=None): 154 def _check_permission(self, action, user, repo_name, ip_addr=None):
155 """ 155 """
156 Checks permissions using action (push/pull) user and repository 156 Checks permissions using action (push/pull) user and repository
157 name 157 name