Mercurial > kallithea
annotate pylons_app/controllers/summary.py @ 173:7c96c0783d43
fixed improper template in admin
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 21 May 2010 03:03:09 +0200 |
parents | 20dc7a5eb748 |
children | b68b2246e5a6 |
rev | line source |
---|---|
82
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
1 import logging |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
2 |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
3 from pylons import tmpl_context as c, app_globals as g, session, request, config, url |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
4 from pylons.controllers.util import abort, redirect |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
5 |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
6 from pylons_app.lib.base import BaseController, render |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
7 from pylons_app.lib.utils import get_repo_slug |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
8 from pylons_app.model.hg_model import HgModel |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
9 log = logging.getLogger(__name__) |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
10 |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
11 class SummaryController(BaseController): |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
12 def __before__(self): |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
13 c.repos_prefix = config['repos_name'] |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
14 c.repo_name = get_repo_slug(request) |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
15 |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
16 def index(self): |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
17 hg_model = HgModel() |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
18 c.repo_info = hg_model.get_repo(c.repo_name) |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
19 c.repo_changesets = c.repo_info.get_changesets(10) |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
20 |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
21 e = request.environ |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
22 uri = r'%(protocol)s://%(user)s@%(host)s/%(repo_name)s' % { |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
23 'protocol': e.get('wsgi.url_scheme'), |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
24 'user':e.get('REMOTE_USER'), |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
25 'host':e.get('HTTP_HOST'), |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
26 'repo_name':c.repo_name, |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
27 } |
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
28 c.clone_repo_url = url(uri) |
126
cfddee9d3693
Updated summary page
Marcin Kuzminski <marcin@python-works.com>
parents:
107
diff
changeset
|
29 c.repo_tags = c.repo_info.tags[:10] |
cfddee9d3693
Updated summary page
Marcin Kuzminski <marcin@python-works.com>
parents:
107
diff
changeset
|
30 c.repo_branches = c.repo_info.branches[:10] |
82
670713507d03
Moved summary to seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
31 return render('/summary.html') |