##// END OF EJS Templates
Added changeset controllers
marcink -
r103:665b3449 default
parent child Browse files
Show More
@@ -0,0 +1,20
1 import logging
2
3 from pylons import request, response, session, tmpl_context as c, url, config, app_globals as g
4 from pylons.controllers.util import abort, redirect
5
6 from pylons_app.lib.base import BaseController, render
7 from pylons_app.lib.utils import get_repo_slug
8 from pylons_app.model.hg_model import HgModel
9 log = logging.getLogger(__name__)
10
11 class ChangesetController(BaseController):
12 def __before__(self):
13 c.repos_prefix = config['repos_name']
14 c.repo_name = get_repo_slug(request)
15
16 def index(self):
17 # Return a rendered template
18 #return render('/changeset.mako')
19 # or, return a string
20 return 'Hello World'
@@ -0,0 +1,7
1 from pylons_app.tests import *
2
3 class TestChangesetController(TestController):
4
5 def test_index(self):
6 response = self.app.get(url(controller='changeset', action='index'))
7 # Test response...
@@ -1,43 +1,44
1 1 """Routes configuration
2 2
3 3 The more specific and detailed routes should be defined first so they
4 4 may take precedent over the more generic routes. For more information
5 5 refer to the routes manual at http://routes.groovie.org/docs/
6 6 """
7 7 from routes import Mapper
8 8
9 9 def make_map(config):
10 10 """Create, configure and return the routes Mapper"""
11 11 map = Mapper(directory=config['pylons.paths']['controllers'],
12 12 always_scan=config['debug'])
13 13 map.minimization = False
14 14 map.explicit = False
15 15
16 16 # The ErrorController route (handles 404/500 error pages); it should
17 17 # likely stay at the top, ensuring it can always be resolved
18 18 map.connect('/error/{action}', controller='error')
19 19 map.connect('/error/{action}/{id}', controller='error')
20 20
21 21 # CUSTOM ROUTES HERE
22 22 map.connect('hg_home', '/', controller='hg', action='index')
23 23
24 24
25 25 #REST controllers
26 26 map.resource('repo', 'repos', path_prefix='/_admin')
27 27 map.resource('user', 'users', path_prefix='/_admin')
28 28
29 29 #ADMIN
30 30 with map.submapper(path_prefix='/_admin', controller='admin') as m:
31 31 m.connect('admin_home', '/', action='index')#main page
32 32 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo')
33 33
34 34
35 map.connect('changeset_home', '/{repo_name}/changeset/{revision}', controller='changeset', revision='tip')
35 36 map.connect('summary_home', '/{repo_name}/summary', controller='summary')
36 37 map.connect('changelog_home', '/{repo_name}/changelog', controller='changelog')
37 38 map.connect('branches_home', '/{repo_name}/branches', controller='branches')
38 39 map.connect('tags_home', '/{repo_name}/tags', controller='tags')
39 40 map.connect('graph_home', '/{repo_name}/graph/{revision}', controller='graph', revision='tip')
40 41 map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}', controller='files', revision='tip', f_path='')
41 42
42 43
43 44 return map
General Comments 0
You need to be logged in to leave comments. Login now