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 | """Routes configuration |
|
1 | """Routes configuration | |
2 |
|
2 | |||
3 | The more specific and detailed routes should be defined first so they |
|
3 | The more specific and detailed routes should be defined first so they | |
4 | may take precedent over the more generic routes. For more information |
|
4 | may take precedent over the more generic routes. For more information | |
5 | refer to the routes manual at http://routes.groovie.org/docs/ |
|
5 | refer to the routes manual at http://routes.groovie.org/docs/ | |
6 | """ |
|
6 | """ | |
7 | from routes import Mapper |
|
7 | from routes import Mapper | |
8 |
|
8 | |||
9 | def make_map(config): |
|
9 | def make_map(config): | |
10 | """Create, configure and return the routes Mapper""" |
|
10 | """Create, configure and return the routes Mapper""" | |
11 | map = Mapper(directory=config['pylons.paths']['controllers'], |
|
11 | map = Mapper(directory=config['pylons.paths']['controllers'], | |
12 | always_scan=config['debug']) |
|
12 | always_scan=config['debug']) | |
13 | map.minimization = False |
|
13 | map.minimization = False | |
14 | map.explicit = False |
|
14 | map.explicit = False | |
15 |
|
15 | |||
16 | # The ErrorController route (handles 404/500 error pages); it should |
|
16 | # The ErrorController route (handles 404/500 error pages); it should | |
17 | # likely stay at the top, ensuring it can always be resolved |
|
17 | # likely stay at the top, ensuring it can always be resolved | |
18 | map.connect('/error/{action}', controller='error') |
|
18 | map.connect('/error/{action}', controller='error') | |
19 | map.connect('/error/{action}/{id}', controller='error') |
|
19 | map.connect('/error/{action}/{id}', controller='error') | |
20 |
|
20 | |||
21 | # CUSTOM ROUTES HERE |
|
21 | # CUSTOM ROUTES HERE | |
22 | map.connect('hg_home', '/', controller='hg', action='index') |
|
22 | map.connect('hg_home', '/', controller='hg', action='index') | |
23 |
|
23 | |||
24 |
|
24 | |||
25 | #REST controllers |
|
25 | #REST controllers | |
26 | map.resource('repo', 'repos', path_prefix='/_admin') |
|
26 | map.resource('repo', 'repos', path_prefix='/_admin') | |
27 | map.resource('user', 'users', path_prefix='/_admin') |
|
27 | map.resource('user', 'users', path_prefix='/_admin') | |
28 |
|
28 | |||
29 | #ADMIN |
|
29 | #ADMIN | |
30 | with map.submapper(path_prefix='/_admin', controller='admin') as m: |
|
30 | with map.submapper(path_prefix='/_admin', controller='admin') as m: | |
31 | m.connect('admin_home', '/', action='index')#main page |
|
31 | m.connect('admin_home', '/', action='index')#main page | |
32 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo') |
|
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 | map.connect('summary_home', '/{repo_name}/summary', controller='summary') |
|
36 | map.connect('summary_home', '/{repo_name}/summary', controller='summary') | |
36 | map.connect('changelog_home', '/{repo_name}/changelog', controller='changelog') |
|
37 | map.connect('changelog_home', '/{repo_name}/changelog', controller='changelog') | |
37 | map.connect('branches_home', '/{repo_name}/branches', controller='branches') |
|
38 | map.connect('branches_home', '/{repo_name}/branches', controller='branches') | |
38 | map.connect('tags_home', '/{repo_name}/tags', controller='tags') |
|
39 | map.connect('tags_home', '/{repo_name}/tags', controller='tags') | |
39 | map.connect('graph_home', '/{repo_name}/graph/{revision}', controller='graph', revision='tip') |
|
40 | map.connect('graph_home', '/{repo_name}/graph/{revision}', controller='graph', revision='tip') | |
40 | map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}', controller='files', revision='tip', f_path='') |
|
41 | map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}', controller='files', revision='tip', f_path='') | |
41 |
|
42 | |||
42 |
|
43 | |||
43 | return map |
|
44 | return map |
General Comments 0
You need to be logged in to leave comments.
Login now