# HG changeset patch # User Marcin Kuzminski # Date 1306364793 -7200 # Node ID dccba44ee176e56cf1e9fc26a251ce442f86927f # Parent 43b8e161be3fb66ac879de917d0dd021568baa71 translated resource map into full routes map, added validation for repos_group id diff -r 43b8e161be3f -r dccba44ee176 rhodecode/config/routing.py --- a/rhodecode/config/routing.py Wed May 25 10:27:29 2011 +0200 +++ b/rhodecode/config/routing.py Thu May 26 01:06:33 2011 +0200 @@ -29,6 +29,13 @@ repo_name = match_dict.get('repo_name') return not cr(repo_name, config['base_path']) + + def check_int(environ, match_dict): + return match_dict.get('id').isdigit() + + + + # The ErrorController route (handles 404/500 error pages); it should # likely stay at the top, ensuring it can always be resolved rmap.connect('/error/{action}', controller='error') @@ -104,9 +111,37 @@ action="repo_pull", conditions=dict(method=["PUT"], function=check_repo)) - #ADMIN REPOS GROUP REST ROUTES - rmap.resource('repos_group', 'repos_groups', - controller='admin/repos_groups', path_prefix=ADMIN_PREFIX) + with rmap.submapper(path_prefix=ADMIN_PREFIX, + controller='admin/repos_groups') as m: + m.connect("repos_groups", "/repos_groups", + action="create", conditions=dict(method=["POST"])) + m.connect("repos_groups", "/repos_groups", + action="index", conditions=dict(method=["GET"])) + m.connect("formatted_repos_groups", "/repos_groups.{format}", + action="index", conditions=dict(method=["GET"])) + m.connect("new_repos_group", "/repos_groups/new", + action="new", conditions=dict(method=["GET"])) + m.connect("formatted_new_repos_group", "/repos_groups/new.{format}", + action="new", conditions=dict(method=["GET"])) + m.connect("update_repos_group", "/repos_groups/{id}", + action="update", conditions=dict(method=["PUT"], + function=check_int)) + m.connect("delete_repos_group", "/repos_groups/{id}", + action="delete", conditions=dict(method=["DELETE"], + function=check_int)) + m.connect("edit_repos_group", "/repos_groups/{id}/edit", + action="edit", conditions=dict(method=["GET"], + function=check_int)) + m.connect("formatted_edit_repos_group", + "/repos_groups/{id}.{format}/edit", + action="edit", conditions=dict(method=["GET"], + function=check_int)) + m.connect("repos_group", "/repos_groups/{id}", + action="show", conditions=dict(method=["GET"], + function=check_int)) + m.connect("formatted_repos_group", "/repos_groups/{id}.{format}", + action="show", conditions=dict(method=["GET"], + function=check_int)) #ADMIN USER REST ROUTES with rmap.submapper(path_prefix=ADMIN_PREFIX,