annotate pylons_app/controllers/shortlog.py @ 192:f191f99f59c9

full changelog caching, secured changelog with LoginRequired, some minor changes in graph
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 22 May 2010 01:58:36 +0200
parents b68b2246e5a6
children a83a1799480c
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
191
b68b2246e5a6 Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents: 127
diff changeset
10 from pylons_app.lib.auth import LoginRequired
86
e47d1db5ef20 Added few options to configs,
Marcin Kuzminski <marcin@python-blog.com>
parents: 83
diff changeset
11
83
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
12 log = logging.getLogger(__name__)
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
13
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
14 class ShortlogController(BaseController):
191
b68b2246e5a6 Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents: 127
diff changeset
15
b68b2246e5a6 Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents: 127
diff changeset
16 @LoginRequired()
83
db39d0ca5308 implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
17 def __before__(self):
191
b68b2246e5a6 Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents: 127
diff changeset
18 super(ShortlogController, self).__before__()
83
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)
127
20dc7a5eb748 Html changes and cleanups, made folders for html templates, implemented tags and branches pages
Marcin Kuzminski <marcin@python-works.com>
parents: 101
diff changeset
25 c.shortlog_data = render('shortlog/shortlog_data.html')
83
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
127
20dc7a5eb748 Html changes and cleanups, made folders for html templates, implemented tags and branches pages
Marcin Kuzminski <marcin@python-works.com>
parents: 101
diff changeset
28 r = render('shortlog/shortlog.html')
86
e47d1db5ef20 Added few options to configs,
Marcin Kuzminski <marcin@python-blog.com>
parents: 83
diff changeset
29 return r