comparison rhodecode/model/forms.py @ 1324:e272be3244f0 beta

fixed regresion made in previos commit, that introduced bug in handling regular repositories
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 12 May 2011 00:37:40 +0200
parents a7a772ea7b95
children 3bce31f026b8
comparison
equal deleted inserted replaced
1323:a7a772ea7b95 1324:e272be3244f0
215 slug = repo_name_slug(repo_name) 215 slug = repo_name_slug(repo_name)
216 if slug in ['_admin', '']: 216 if slug in ['_admin', '']:
217 e_dict = {'repo_name': _('This repository name is disallowed')} 217 e_dict = {'repo_name': _('This repository name is disallowed')}
218 raise formencode.Invalid('', value, state, error_dict=e_dict) 218 raise formencode.Invalid('', value, state, error_dict=e_dict)
219 219
220 gr = Group.get(value.get('repo_group')) 220
221 221 if value.get('repo_group'):
222 # value needs to be aware of group name 222 gr = Group.get(value.get('repo_group'))
223 repo_name_full = gr.full_path + '/' + repo_name 223 group_path = gr.full_path
224 # value needs to be aware of group name
225 repo_name_full = group_path + '/' + repo_name
226 else:
227 group_path = ''
228 repo_name_full = repo_name
229
230
224 value['repo_name_full'] = repo_name_full 231 value['repo_name_full'] = repo_name_full
225 if old_data.get('repo_name') != repo_name_full or not edit: 232 if old_data.get('repo_name') != repo_name_full or not edit:
226 233
227 if gr.full_path != '': 234 if group_path != '':
228 if RepoModel().get_by_repo_name(repo_name_full,): 235 if RepoModel().get_by_repo_name(repo_name_full,):
229 e_dict = {'repo_name':_('This repository already ' 236 e_dict = {'repo_name':_('This repository already '
230 'exists in group "%s"') % 237 'exists in group "%s"') %
231 gr.group_name} 238 gr.group_name}
232 raise formencode.Invalid('', value, state, 239 raise formencode.Invalid('', value, state,
233 error_dict=e_dict) 240 error_dict=e_dict)
234 241
235 else: 242 else:
236 if RepoModel().get_by_repo_name(repo_name_full): 243 if RepoModel().get_by_repo_name(repo_name_full):
237 e_dict = {'repo_name':_('This repository already exists')} 244 e_dict = {'repo_name':_('This repository '
245 'already exists')}
238 raise formencode.Invalid('', value, state, 246 raise formencode.Invalid('', value, state,
239 error_dict=e_dict) 247 error_dict=e_dict)
240 return value 248 return value
241 249
242 250