changeset 1533:c0e6057543ff beta

fixed hardcoded admin prefix check in forms
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 08 Oct 2011 03:00:26 +0200
parents 2afe9320d5e6
children 72c3cea0175a
files rhodecode/model/forms.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/model/forms.py	Sat Oct 08 03:00:03 2011 +0200
+++ b/rhodecode/model/forms.py	Sat Oct 08 03:00:26 2011 +0200
@@ -32,6 +32,7 @@
 from pylons.i18n.translation import _
 from webhelpers.pylonslib.secure_form import authentication_token
 
+from rhodecode.config.routing import ADMIN_PREFIX
 from rhodecode.lib.utils import repo_name_slug
 from rhodecode.lib.auth import authenticate, get_crypt_password
 from rhodecode.lib.exceptions import LdapImportError
@@ -240,7 +241,7 @@
             repo_name = value.get('repo_name')
 
             slug = repo_name_slug(repo_name)
-            if slug in ['_admin', '']:
+            if slug in [ADMIN_PREFIX, '']:
                 e_dict = {'repo_name': _('This repository name is disallowed')}
                 raise formencode.Invalid('', value, state, error_dict=e_dict)
 
@@ -286,7 +287,7 @@
             repo_name = value.get('fork_name')
 
             slug = repo_name_slug(repo_name)
-            if slug in ['_admin', '']:
+            if slug in [ADMIN_PREFIX, '']:
                 e_dict = {'repo_name': _('This repository name is disallowed')}
                 raise formencode.Invalid('', value, state, error_dict=e_dict)