comparison rhodecode/config/routing.py @ 1813:a8c66e870bd0 beta

implements #285: Implemented non changeable urls for clone url, and web views
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 29 Dec 2011 00:01:05 +0200
parents 2aee0dc1784e
children cf51bbfb120e
comparison
equal deleted inserted replaced
1812:320dec24fb9a 1813:a8c66e870bd0
6 refer to the routes manual at http://routes.groovie.org/docs/ 6 refer to the routes manual at http://routes.groovie.org/docs/
7 """ 7 """
8 from __future__ import with_statement 8 from __future__ import with_statement
9 from routes import Mapper 9 from routes import Mapper
10 10
11
12 # prefix for non repository related links needs to be prefixed with `/` 11 # prefix for non repository related links needs to be prefixed with `/`
13 ADMIN_PREFIX = '/_admin' 12 ADMIN_PREFIX = '/_admin'
14 13
15 14
16 def make_map(config): 15 def make_map(config):
28 check for valid repository for proper 404 handling 27 check for valid repository for proper 404 handling
29 28
30 :param environ: 29 :param environ:
31 :param match_dict: 30 :param match_dict:
32 """ 31 """
33 32 from rhodecode.model.db import Repository
34 repo_name = match_dict.get('repo_name') 33 repo_name = match_dict.get('repo_name')
34
35 try:
36 by_id = repo_name.split('_')
37 if len(by_id) == 2 and by_id[1].isdigit():
38 repo_name = Repository.get(by_id[1]).repo_name
39 match_dict['repo_name'] = repo_name
40 except:
41 pass
42
35 return is_valid_repo(repo_name, config['base_path']) 43 return is_valid_repo(repo_name, config['base_path'])
36 44
37 def check_group(environ, match_dict): 45 def check_group(environ, match_dict):
38 """ 46 """
39 check for valid repositories group for proper 404 handling 47 check for valid repositories group for proper 404 handling