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