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

statics moved to pylons.
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 25 Apr 2010 01:25:54 +0200
parents 5b57295601b6
children a86c8de926b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
93
aec4c0071cb3 added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 import logging
aec4c0071cb3 added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2
99
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
3 from pylons import request, response, session, tmpl_context as c, url, config, app_globals as g
93
aec4c0071cb3 added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4 from pylons.controllers.util import abort, redirect
aec4c0071cb3 added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5
aec4c0071cb3 added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6 from pylons_app.lib.base import BaseController, render
99
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
7 from pylons_app.lib.utils import get_repo_slug
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
8 from pylons_app.model.hg_model import HgModel
93
aec4c0071cb3 added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 log = logging.getLogger(__name__)
aec4c0071cb3 added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
10
aec4c0071cb3 added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 class FilesController(BaseController):
99
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
12 def __before__(self):
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
13 c.repos_prefix = config['repos_name']
101
8b06c420491d statics moved to pylons.
Marcin Kuzminski <marcin@python-works.com>
parents: 99
diff changeset
14
99
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
15 c.repo_name = get_repo_slug(request)
93
aec4c0071cb3 added empty controllers for branches tags files graph, routing and test for them
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16
99
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
17 def index(self, repo_name, revision, f_path):
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
18 hg_model = HgModel()
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
19 c.repo = repo = hg_model.get_repo(c.repo_name)
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
20 c.cur_rev = revision
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
21 c.f_path = f_path
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
22 c.changeset = repo.get_changeset(repo._get_revision('tip'))
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
23
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
24
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
25 c.files_list = c.changeset.get_node(f_path)
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
26
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents: 93
diff changeset
27 return render('/files.html')