annotate pylons_app/controllers/shortlog.py @ 101:8b06c420491d

statics moved to pylons.
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 25 Apr 2010 01:25:54 +0200
parents aec4c0071cb3
children 20dc7a5eb748
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
83
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
1 import logging
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
2
db39d0ca5308 implemented Shortlog as 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
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
4 from pylons.controllers.util import abort, redirect
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
5
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
6 from pylons_app.lib.base import BaseController, render
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
7 from pylons_app.lib.utils import get_repo_slug
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
8 from pylons_app.model.hg_model import HgModel
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
9 from webhelpers.paginate import Page
86
e47d1db5ef20 Added few options to configs,
Marcin Kuzminski <marcin@python-blog.com>
parents: 83
diff changeset
10
83
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
11 log = logging.getLogger(__name__)
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
12
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
13 class ShortlogController(BaseController):
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
14 def __before__(self):
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
15 c.repos_prefix = config['repos_name']
101
8b06c420491d statics moved to pylons.
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
16
83
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
17 c.repo_name = get_repo_slug(request)
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
18
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
19
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
20 def index(self):
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
21 hg_model = HgModel()
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
22 p = int(request.params.get('page', 1))
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
23 repo = hg_model.get_repo(c.repo_name)
93
aec4c0071cb3 added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents: 86
diff changeset
24 c.repo_changesets = Page(repo, page=p, items_per_page=20)
83
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
25 c.shortlog_data = render('shortlog_data.html')
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
26 if request.params.get('partial'):
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
27 return c.shortlog_data
86
e47d1db5ef20 Added few options to configs,
Marcin Kuzminski <marcin@python-blog.com>
parents: 83
diff changeset
28 r = render('/shortlog.html')
e47d1db5ef20 Added few options to configs,
Marcin Kuzminski <marcin@python-blog.com>
parents: 83
diff changeset
29 return r