comparison pylons_app/model/hg_model.py @ 488:853b9425742a celery

fixed sorting in repo list switcher and removed lower() since repo names can be have capital letters now
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 19 Sep 2010 03:42:48 +0200
parents 7afbc45aab28
children 0fce1f9e4dce
comparison
equal deleted inserted replaced
487:b12ea84fb906 488:853b9425742a
57 return HgModel.repo_scan(g.paths[0][0], g.paths[0][1], g.baseui) 57 return HgModel.repo_scan(g.paths[0][0], g.paths[0][1], g.baseui)
58 58
59 @cache_region('super_short_term', 'cached_repos_switcher_list') 59 @cache_region('super_short_term', 'cached_repos_switcher_list')
60 def _get_repos_switcher_cached(cached_repo_list): 60 def _get_repos_switcher_cached(cached_repo_list):
61 repos_lst = [] 61 repos_lst = []
62 for repo in sorted(x for x in cached_repo_list.values()): 62 for repo in [x for x in cached_repo_list.values()]:
63 if HasRepoPermissionAny('repository.write', 'repository.read', 63 if HasRepoPermissionAny('repository.write', 'repository.read',
64 'repository.admin')(repo.name.lower(), 'main page check'): 64 'repository.admin')(repo.name.lower(), 'main page check'):
65 repos_lst.append((repo.name.lower(), repo.dbrepo.private,)) 65 repos_lst.append((repo.name, repo.dbrepo.private,))
66 66
67 return repos_lst 67 return sorted(repos_lst, key=lambda k:k[0])
68 68
69 @cache_region('long_term', 'full_changelog') 69 @cache_region('long_term', 'full_changelog')
70 def _full_changelog_cached(repo_name): 70 def _full_changelog_cached(repo_name):
71 log.info('getting full changelog for %s', repo_name) 71 log.info('getting full changelog for %s', repo_name)
72 return list(reversed(list(HgModel().get_repo(repo_name)))) 72 return list(reversed(list(HgModel().get_repo(repo_name))))