##// END OF EJS Templates
fixed #47 adding a new repo that have a group chosen had wrong paths.
marcink -
r1361:87ca1754 beta
parent child Browse files
Show More
@@ -44,6 +44,7 b' from rhodecode.model.db import User, Rep'
44 44 from rhodecode.model.forms import RepoForm
45 45 from rhodecode.model.scm import ScmModel
46 46 from rhodecode.model.repo import RepoModel
47 from sqlalchemy.exc import IntegrityError
47 48
48 49 log = logging.getLogger(__name__)
49 50
@@ -179,11 +180,12 b' class ReposController(BaseController):'
179 180 category='success')
180 181
181 182 if request.POST.get('user_created'):
183 #created by regular non admin user
182 184 action_logger(self.rhodecode_user, 'user_created_repo',
183 form_result['repo_name'], '', self.sa)
185 form_result['repo_name_full'], '', self.sa)
184 186 else:
185 187 action_logger(self.rhodecode_user, 'admin_created_repo',
186 form_result['repo_name'], '', self.sa)
188 form_result['repo_name_full'], '', self.sa)
187 189
188 190 except formencode.Invalid, errors:
189 191
@@ -287,6 +289,18 b' class ReposController(BaseController):'
287 289 invalidate_cache('get_repo_cached_%s' % repo_name)
288 290 h.flash(_('deleted repository %s') % repo_name, category='success')
289 291
292 except IntegrityError, e:
293 if e.message.find('repositories_fork_id_fkey'):
294 log.error(traceback.format_exc())
295 h.flash(_('Cannot delete %s it still contains attached '
296 'forks') % repo_name,
297 category='warning')
298 else:
299 log.error(traceback.format_exc())
300 h.flash(_('An error occurred during '
301 'deletion of %s') % repo_name,
302 category='error')
303
290 304 except Exception, e:
291 305 log.error(traceback.format_exc())
292 306 h.flash(_('An error occurred during deletion of %s') % repo_name,
@@ -386,6 +386,7 b' def repo2db_mapper(initial_repo_list, re'
386 386 added.append(name)
387 387 form_data = {
388 388 'repo_name': name,
389 'repo_name_full': name,
389 390 'repo_type': repo.alias,
390 391 'description': repo.description \
391 392 if repo.description != 'unknown' else \
@@ -227,8 +227,7 b' class ValidRepoUser(formencode.validator'
227 227
228 228 def to_python(self, value, state):
229 229 try:
230 self.user_db = User.query()\
231 .filter(User.active == True)\
230 User.query().filter(User.active == True)\
232 231 .filter(User.username == value).one()
233 232 except Exception:
234 233 raise formencode.Invalid(_('This username is not valid'),
@@ -251,7 +250,8 b' def ValidRepoName(edit, old_data):'
251 250 gr = Group.get(value.get('repo_group'))
252 251 group_path = gr.full_path
253 252 # value needs to be aware of group name in order to check
254 # db key
253 # db key This is an actuall just the name to store in the
254 # database
255 255 repo_name_full = group_path + Group.url_sep() + repo_name
256 256 else:
257 257 group_path = ''
@@ -198,14 +198,17 b' class RepoModel(BaseModel):'
198 198 #force str since hg doesn't go with unicode
199 199 repo_name = str(form_data['fork_name'])
200 200 org_name = str(form_data['repo_name'])
201 org_full_name = str(form_data['repo_name_full'])
201 202
202 203 else:
203 204 org_name = repo_name = str(form_data['repo_name'])
205 repo_name_full = form_data['repo_name_full']
206
204 207 new_repo = Repository()
205 208 new_repo.enable_statistics = False
206 209 for k, v in form_data.items():
207 210 if k == 'repo_name':
208 v = repo_name
211 v = repo_name_full
209 212 if k == 'repo_group':
210 213 k = 'group_id'
211 214
@@ -213,7 +216,7 b' class RepoModel(BaseModel):'
213 216
214 217 if fork:
215 218 parent_repo = self.sa.query(Repository)\
216 .filter(Repository.repo_name == org_name).scalar()
219 .filter(Repository.repo_name == org_full_name).scalar()
217 220 new_repo.fork = parent_repo
218 221
219 222 new_repo.user_id = cur_user.user_id
@@ -309,7 +312,9 b' class RepoModel(BaseModel):'
309 312
310 313 def __create_repo(self, repo_name, alias, new_parent_id, clone_uri=False):
311 314 """
312 makes repository on filesystem it's group aware
315 makes repository on filesystem. It's group aware means it'll create
316 a repository within a group, and alter the paths accordingly of
317 group location
313 318
314 319 :param repo_name:
315 320 :param alias:
General Comments 0
You need to be logged in to leave comments. Login now