diff options
author | Marcin Kuzminski <marcin@python-works.com> | 2011-10-07 02:51:18 +0200 |
---|---|---|
committer | Marcin Kuzminski <marcin@python-works.com> | 2011-10-07 02:51:18 +0200 |
commit | 7d0154b1871994bc5096331fc4de0f7706df631d (patch) | |
tree | e80002690e2698e2afa3d929d4380ae38e67f6da /rhodecode/model/forms.py | |
parent | cbf69f4995266aac0d87991f17f4a5c2d1c33ece (diff) |
fixed issues with python2.5
added compat module to rhodecode to have one point of fetching backward incompatible libs.
--HG--
branch : beta
Diffstat (limited to 'rhodecode/model/forms.py')
-rw-r--r-- | rhodecode/model/forms.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py index 3520581b..81c0ac6f 100644 --- a/rhodecode/model/forms.py +++ b/rhodecode/model/forms.py @@ -283,6 +283,19 @@ def ValidRepoName(edit, old_data): def ValidForkName(): class _ValidForkName(formencode.validators.FancyValidator): def to_python(self, value, state): + + repo_name = value.get('fork_name') + + slug = repo_name_slug(repo_name) + if slug in ['_admin', '']: + e_dict = {'repo_name': _('This repository name is disallowed')} + raise formencode.Invalid('', value, state, error_dict=e_dict) + + if RepoModel().get_by_repo_name(repo_name): + e_dict = {'fork_name':_('This repository ' + 'already exists')} + raise formencode.Invalid('', value, state, + error_dict=e_dict) return value return _ValidForkName |