comparison rhodecode/model/forms.py @ 1515:da8f1d1b22de

merge stable with beta
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 07 Oct 2011 02:53:29 +0200
parents bf263968da47 87ec80c280bb
children 752b0a7b7679
comparison
equal deleted inserted replaced
1513:12946daf44f9 1515:da8f1d1b22de
281 return _ValidRepoName 281 return _ValidRepoName
282 282
283 def ValidForkName(): 283 def ValidForkName():
284 class _ValidForkName(formencode.validators.FancyValidator): 284 class _ValidForkName(formencode.validators.FancyValidator):
285 def to_python(self, value, state): 285 def to_python(self, value, state):
286
287 repo_name = value.get('fork_name')
288
289 slug = repo_name_slug(repo_name)
290 if slug in ['_admin', '']:
291 e_dict = {'repo_name': _('This repository name is disallowed')}
292 raise formencode.Invalid('', value, state, error_dict=e_dict)
293
294 if RepoModel().get_by_repo_name(repo_name):
295 e_dict = {'fork_name':_('This repository '
296 'already exists')}
297 raise formencode.Invalid('', value, state,
298 error_dict=e_dict)
286 return value 299 return value
287 return _ValidForkName 300 return _ValidForkName
288 301
289 302
290 def SlugifyName(): 303 def SlugifyName():