Mercurial > kallithea
comparison rhodecode/model/repo.py @ 1028:f42ee60e673b beta
fixed issue with db transaction when filesystem creation of repository failed
added extra logging
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 11 Feb 2011 11:30:04 +0100 |
parents | 26114d182efe |
children | 405b80e4ccd5 |
comparison
equal
deleted
inserted
replaced
1027:6ba61c252ee4 | 1028:f42ee60e673b |
---|---|
209 | 209 |
210 repo_to_perm.permission_id = self.sa.query(Permission)\ | 210 repo_to_perm.permission_id = self.sa.query(Permission)\ |
211 .filter(Permission.permission_name == default_perm)\ | 211 .filter(Permission.permission_name == default_perm)\ |
212 .one().permission_id | 212 .one().permission_id |
213 | 213 |
214 repo_to_perm.repository_id = new_repo.repo_id | 214 repo_to_perm.repository = new_repo |
215 repo_to_perm.user_id = UserModel(self.sa)\ | 215 repo_to_perm.user_id = UserModel(self.sa)\ |
216 .get_by_username('default', cache=False).user_id | 216 .get_by_username('default', cache=False).user_id |
217 | 217 |
218 self.sa.add(repo_to_perm) | 218 self.sa.add(repo_to_perm) |
219 self.sa.commit() | 219 |
220 | 220 if not just_db: |
221 self.__create_repo(repo_name, form_data['repo_type']) | |
222 | |
223 self.sa.commit() | |
221 | 224 |
222 #now automatically start following this repository as owner | 225 #now automatically start following this repository as owner |
223 from rhodecode.model.scm import ScmModel | 226 from rhodecode.model.scm import ScmModel |
224 ScmModel(self.sa).toggle_following_repo(new_repo.repo_id, | 227 ScmModel(self.sa).toggle_following_repo(new_repo.repo_id, |
225 cur_user.user_id) | 228 cur_user.user_id) |
226 | 229 |
227 if not just_db: | |
228 self.__create_repo(repo_name, form_data['repo_type']) | |
229 except: | 230 except: |
230 log.error(traceback.format_exc()) | 231 log.error(traceback.format_exc()) |
231 self.sa.rollback() | 232 self.sa.rollback() |
232 raise | 233 raise |
233 | 234 |