Show More
@@ -3,7 +3,6 b' import os' | |||
|
3 | 3 | |
|
4 | 4 | from pylons import request, response, session, tmpl_context as c, url, app_globals as g |
|
5 | 5 | from pylons.controllers.util import abort, redirect |
|
6 | from beaker.cache import region_invalidate | |
|
7 | 6 | from pylons_app.lib.base import BaseController, render |
|
8 | 7 | from pylons_app.lib import auth |
|
9 | 8 | from pylons_app.model.forms import LoginForm |
@@ -12,7 +11,8 b' import formencode.htmlfill as htmlfill' | |||
|
12 | 11 | from pylons_app.model import meta |
|
13 | 12 | from pylons_app.model.db import Users, UserLogs |
|
14 | 13 | from webhelpers.paginate import Page |
|
15 | from pylons_app.lib.utils import check_repo | |
|
14 | from pylons_app.lib.utils import check_repo, invalidate_cache | |
|
15 | ||
|
16 | 16 | log = logging.getLogger(__name__) |
|
17 | 17 | |
|
18 | 18 | class AdminController(BaseController): |
@@ -81,9 +81,8 b' class AdminController(BaseController):' | |||
|
81 | 81 | self._create_repo(new_repo) |
|
82 | 82 | c.new_repo = new_repo |
|
83 | 83 | c.msg = 'added repo' |
|
84 | from pylons_app.lib.base import _get_repos | |
|
85 | 84 | #clear our cached list for refresh with new repo |
|
86 |
|
|
|
85 | invalidate_cache('repo_list_2') | |
|
87 | 86 | except Exception as e: |
|
88 | 87 | c.new_repo = 'Exception when adding: %s' % new_repo |
|
89 | 88 | c.msg = str(e) |
@@ -10,6 +10,7 b' from pylons_app.lib.auth import authenti' | |||
|
10 | 10 | from pylons_app.model.hg_model import HgModel |
|
11 | 11 | from operator import itemgetter |
|
12 | 12 | import shutil |
|
13 | from pylons_app.lib.utils import invalidate_cache | |
|
13 | 14 | log = logging.getLogger(__name__) |
|
14 | 15 | |
|
15 | 16 | class ReposController(BaseController): |
@@ -64,6 +65,10 b' class ReposController(BaseController):' | |||
|
64 | 65 | log.info("Removing %s", rm_path) |
|
65 | 66 | shutil.move(os.path.join(rm_path, '.hg'), os.path.join(rm_path, 'rm__.hg')) |
|
66 | 67 | shutil.move(rm_path, os.path.join(path, 'rm__%s-%s' % (datetime.today(), id))) |
|
68 | ||
|
69 | #clear our cached list for refresh with new repo | |
|
70 | invalidate_cache('repo_list_2') | |
|
71 | ||
|
67 | 72 | return redirect(url('repos')) |
|
68 | 73 | |
|
69 | 74 |
@@ -90,6 +90,14 b" def make_ui(path='hgwebdir.config', chec" | |||
|
90 | 90 | |
|
91 | 91 | return baseui |
|
92 | 92 | |
|
93 | def invalidate_cache(name): | |
|
94 | from beaker.cache import region_invalidate | |
|
95 | if name == 'repo_list_2': | |
|
96 | log.info('INVALIDATING CACHE FOR %s', name) | |
|
97 | from pylons_app.lib.base import _get_repos | |
|
98 | #clear our cached list for refresh with new repo | |
|
99 | region_invalidate(_get_repos, None, 'repo_list_2') | |
|
100 | ||
|
93 | 101 | from vcs.backends.base import BaseChangeset |
|
94 | 102 | from vcs.utils.lazy import LazyProperty |
|
95 | 103 | class EmptyChangeset(BaseChangeset): |
General Comments 0
You need to be logged in to leave comments.
Login now