##// END OF EJS Templates
admin path fix
marcink -
r306:43b229a8 default
parent child Browse files
Show More
@@ -1,118 +1,118
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 from pylons_app.lib.utils import check_repo_fast as cr
9 9
10 10 def make_map(config):
11 11 """Create, configure and return the routes Mapper"""
12 12 map = Mapper(directory=config['pylons.paths']['controllers'],
13 13 always_scan=config['debug'])
14 14 map.minimization = False
15 15 map.explicit = False
16 16
17 17 # The ErrorController route (handles 404/500 error pages); it should
18 18 # likely stay at the top, ensuring it can always be resolved
19 19 map.connect('/error/{action}', controller='error')
20 20 map.connect('/error/{action}/{id}', controller='error')
21 21
22 22 # CUSTOM ROUTES HERE
23 23 map.connect('hg_home', '/', controller='hg', action='index')
24 24
25 25 def check_repo(environ, match_dict):
26 26 """
27 27 check for valid repository for proper 404 handling
28 28 @param environ:
29 29 @param match_dict:
30 30 """
31 31 repo_name = match_dict.get('repo_name')
32 32 return not cr(repo_name, config['base_path'])
33 33
34 34 #REST routes
35 35 with map.submapper(path_prefix='/_admin', controller='repos') as m:
36 36 m.connect("repos", "/repos",
37 37 action="create", conditions=dict(method=["POST"]))
38 38 m.connect("repos", "/repos",
39 39 action="index", conditions=dict(method=["GET"]))
40 40 m.connect("formatted_repos", "/repos.{format}",
41 41 action="index",
42 42 conditions=dict(method=["GET"]))
43 43 m.connect("new_repo", "/repos/new",
44 44 action="new", conditions=dict(method=["GET"]))
45 45 m.connect("formatted_new_repo", "/repos/new.{format}",
46 46 action="new", conditions=dict(method=["GET"]))
47 47 m.connect("/repos/{repo_name:.*}",
48 48 action="update", conditions=dict(method=["PUT"],
49 49 function=check_repo))
50 50 m.connect("/repos/{repo_name:.*}",
51 51 action="delete", conditions=dict(method=["DELETE"],
52 52 function=check_repo))
53 53 m.connect("edit_repo", "/repos/{repo_name:.*}/edit",
54 54 action="edit", conditions=dict(method=["GET"],
55 55 function=check_repo))
56 56 m.connect("formatted_edit_repo", "/repos/{repo_name:.*}.{format}/edit",
57 57 action="edit", conditions=dict(method=["GET"],
58 58 function=check_repo))
59 59 m.connect("repo", "/repos/{repo_name:.*}",
60 60 action="show", conditions=dict(method=["GET"],
61 61 function=check_repo))
62 62 m.connect("formatted_repo", "/repos/{repo_name:.*}.{format}",
63 63 action="show", conditions=dict(method=["GET"],
64 64 function=check_repo))
65 65 #ajax delete repo perm user
66 66 m.connect('delete_repo_user', "/repos_delete_user/{repo_name:.*}",
67 67 action="delete_perm_user", conditions=dict(method=["DELETE"],
68 68 function=check_repo))
69 69
70 70 map.resource('user', 'users', path_prefix='/_admin')
71 71 map.resource('permission', 'permissions', path_prefix='/_admin')
72 72
73 73 #ADMIN
74 74 with map.submapper(path_prefix='/_admin', controller='admin') as m:
75 m.connect('admin_home', '/', action='index')#main page
75 m.connect('admin_home', '', action='index')#main page
76 76 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}',
77 77 action='add_repo')
78 78
79 79 #FEEDS
80 80 map.connect('rss_feed_home', '/{repo_name:.*}/feed/rss',
81 81 controller='feed', action='rss',
82 82 conditions=dict(function=check_repo))
83 83 map.connect('atom_feed_home', '/{repo_name:.*}/feed/atom',
84 84 controller='feed', action='atom',
85 85 conditions=dict(function=check_repo))
86 86
87 87 map.connect('login_home', '/login', controller='login')
88 88 map.connect('logout_home', '/logout', controller='login', action='logout')
89 89
90 90 map.connect('changeset_home', '/{repo_name:.*}/changeset/{revision}',
91 91 controller='changeset', revision='tip',
92 92 conditions=dict(function=check_repo))
93 93 map.connect('summary_home', '/{repo_name:.*}/summary',
94 94 controller='summary', conditions=dict(function=check_repo))
95 95 map.connect('shortlog_home', '/{repo_name:.*}/shortlog',
96 96 controller='shortlog', conditions=dict(function=check_repo))
97 97 map.connect('branches_home', '/{repo_name:.*}/branches',
98 98 controller='branches', conditions=dict(function=check_repo))
99 99 map.connect('tags_home', '/{repo_name:.*}/tags',
100 100 controller='tags', conditions=dict(function=check_repo))
101 101 map.connect('changelog_home', '/{repo_name:.*}/changelog',
102 102 controller='changelog', conditions=dict(function=check_repo))
103 103 map.connect('files_home', '/{repo_name:.*}/files/{revision}/{f_path:.*}',
104 104 controller='files', revision='tip', f_path='',
105 105 conditions=dict(function=check_repo))
106 106 map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}',
107 107 controller='files', action='diff', revision='tip', f_path='',
108 108 conditions=dict(function=check_repo))
109 109 map.connect('files_raw_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}',
110 110 controller='files', action='rawfile', revision='tip', f_path='',
111 111 conditions=dict(function=check_repo))
112 112 map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}',
113 113 controller='files', action='annotate', revision='tip', f_path='',
114 114 conditions=dict(function=check_repo))
115 115 map.connect('files_archive_home', '/{repo_name:.*}/archive/{revision}/{fileformat}',
116 116 controller='files', action='archivefile', revision='tip',
117 117 conditions=dict(function=check_repo))
118 118 return map
General Comments 0
You need to be logged in to leave comments. Login now