diff 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
line wrap: on
line diff
--- a/rhodecode/config/routing.py	Wed Dec 28 23:57:57 2011 +0200
+++ b/rhodecode/config/routing.py	Thu Dec 29 00:01:05 2011 +0200
@@ -8,7 +8,6 @@
 from __future__ import with_statement
 from routes import Mapper
 
-
 # prefix for non repository related links needs to be prefixed with `/`
 ADMIN_PREFIX = '/_admin'
 
@@ -30,8 +29,17 @@
         :param environ:
         :param match_dict:
         """
+        from rhodecode.model.db import Repository
+        repo_name = match_dict.get('repo_name')
 
-        repo_name = match_dict.get('repo_name')
+        try:
+            by_id = repo_name.split('_')
+            if len(by_id) == 2 and by_id[1].isdigit():
+                repo_name = Repository.get(by_id[1]).repo_name
+                match_dict['repo_name'] = repo_name
+        except:
+            pass
+
         return is_valid_repo(repo_name, config['base_path'])
 
     def check_group(environ, match_dict):