Mercurial > public > src > rhodecode
comparison pylons_app/controllers/repos.py @ 169:8e01265fb586
added long term caching of repo_list to the base controller. changed hg and repos to use that cached list.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 21 May 2010 02:17:13 +0200 |
parents | 988477a05db6 |
children | b68b2246e5a6 |
comparison
equal
deleted
inserted
replaced
168:e35210568664 | 169:8e01265fb586 |
---|---|
24 c.admin_username = session.get('admin_username') | 24 c.admin_username = session.get('admin_username') |
25 | 25 |
26 def index(self, format='html'): | 26 def index(self, format='html'): |
27 """GET /repos: All items in the collection""" | 27 """GET /repos: All items in the collection""" |
28 # url('repos') | 28 # url('repos') |
29 hg_model = HgModel() | 29 c.repos_list = c.cached_repo_list |
30 c.repos_list = list(hg_model.get_repos()) | |
31 c.repos_list.sort(key=itemgetter('name')) | |
32 return render('admin/repos/repos.html') | 30 return render('admin/repos/repos.html') |
33 | 31 |
34 def create(self): | 32 def create(self): |
35 """POST /repos: Create a new item""" | 33 """POST /repos: Create a new item""" |
36 # url('repos') | 34 # url('repos') |
62 log.info("Removing %s", rm_path) | 60 log.info("Removing %s", rm_path) |
63 shutil.move(os.path.join(rm_path, '.hg'), os.path.join(rm_path, 'rm__.hg')) | 61 shutil.move(os.path.join(rm_path, '.hg'), os.path.join(rm_path, 'rm__.hg')) |
64 shutil.move(rm_path, os.path.join(path, 'rm__%s-%s' % (datetime.today(), id))) | 62 shutil.move(rm_path, os.path.join(path, 'rm__%s-%s' % (datetime.today(), id))) |
65 | 63 |
66 #clear our cached list for refresh with new repo | 64 #clear our cached list for refresh with new repo |
67 invalidate_cache('repo_list_2') | 65 invalidate_cache('cached_repo_list') |
68 | 66 |
69 return redirect(url('repos')) | 67 return redirect(url('repos')) |
70 | 68 |
71 | 69 |
72 def show(self, id, format='html'): | 70 def show(self, id, format='html'): |