Mercurial > kallithea
comparison rhodecode/controllers/summary.py @ 1244:0eceb478c720 beta
fixed issue #165 trending source files are now stored in cache as ext only, and translated to description only when displaying, so future changes of mappings will take affect right away.
Also changes the way how map is generating, ie. autogenerate from pygments lexers, and than complete with user defined mappings.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 11 Apr 2011 22:24:04 +0200 |
parents | 50e41777675d |
children | 13b507b73190 |
comparison
equal
deleted
inserted
replaced
1243:e82d6aaa2456 | 1244:0eceb478c720 |
---|---|
39 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | 39 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
40 from rhodecode.lib.base import BaseRepoController, render | 40 from rhodecode.lib.base import BaseRepoController, render |
41 from rhodecode.lib.utils import OrderedDict, EmptyChangeset | 41 from rhodecode.lib.utils import OrderedDict, EmptyChangeset |
42 | 42 |
43 from rhodecode.lib.celerylib import run_task | 43 from rhodecode.lib.celerylib import run_task |
44 from rhodecode.lib.celerylib.tasks import get_commits_stats | 44 from rhodecode.lib.celerylib.tasks import get_commits_stats, \ |
45 LANGUAGES_EXTENSIONS_MAP | |
45 from rhodecode.lib.helpers import RepoPage | 46 from rhodecode.lib.helpers import RepoPage |
46 | 47 |
47 try: | 48 try: |
48 import json | 49 import json |
49 except ImportError: | 50 except ImportError: |
129 if stats and stats.languages: | 130 if stats and stats.languages: |
130 c.no_data = False is dbrepo.enable_statistics | 131 c.no_data = False is dbrepo.enable_statistics |
131 lang_stats = json.loads(stats.languages) | 132 lang_stats = json.loads(stats.languages) |
132 c.commit_data = stats.commit_activity | 133 c.commit_data = stats.commit_activity |
133 c.overview_data = stats.commit_activity_combined | 134 c.overview_data = stats.commit_activity_combined |
135 | |
136 lang_stats = [(x, {"count":y, | |
137 "desc":LANGUAGES_EXTENSIONS_MAP.get(x)}) | |
138 for x, y in lang_stats.items()] | |
139 print lang_stats | |
140 | |
134 c.trending_languages = json.dumps(OrderedDict( | 141 c.trending_languages = json.dumps(OrderedDict( |
135 sorted(lang_stats.items(), reverse=True, | 142 sorted(lang_stats, reverse=True, |
136 key=lambda k: k[1])[:10] | 143 key=lambda k: k[1])[:10] |
137 ) | 144 ) |
138 ) | 145 ) |
139 last_rev = stats.stat_on_revision | 146 last_rev = stats.stat_on_revision |
140 c.repo_last_rev = c.rhodecode_repo.count() - 1 \ | 147 c.repo_last_rev = c.rhodecode_repo.count() - 1 \ |