##// END OF EJS Templates
bugfix when form had errors, it was crashing
marcink -
r821:2b5f0e76 beta
parent child Browse files
Show More
@@ -141,6 +141,20 b' class ReposController(BaseController):'
141
141
142 except formencode.Invalid, errors:
142 except formencode.Invalid, errors:
143 c.repo_info = repo_model.get_by_repo_name(repo_name)
143 c.repo_info = repo_model.get_by_repo_name(repo_name)
144 if c.repo_info.stats:
145 last_rev = c.repo_info.stats.stat_on_revision
146 else:
147 last_rev = 0
148 c.stats_revision = last_rev
149 r = ScmModel().get(repo_name)
150 c.repo_last_rev = r.revisions[-1] if r.revisions else 0
151
152 if last_rev == 0:
153 c.stats_percentage = 0
154 else:
155 c.stats_percentage = '%.2f' % ((float((last_rev)) /
156 c.repo_last_rev) * 100)
157
144 c.users_array = repo_model.get_users_js()
158 c.users_array = repo_model.get_users_js()
145 errors.value.update({'user':c.repo_info.user.username})
159 errors.value.update({'user':c.repo_info.user.username})
146 return htmlfill.render(
160 return htmlfill.render(
@@ -245,9 +259,9 b' class ReposController(BaseController):'
245 """GET /repos/repo_name/edit: Form to edit an existing item"""
259 """GET /repos/repo_name/edit: Form to edit an existing item"""
246 # url('edit_repo', repo_name=ID)
260 # url('edit_repo', repo_name=ID)
247 repo_model = RepoModel()
261 repo_model = RepoModel()
248 c.repo_info = repo = repo_model.get_by_repo_name(repo_name)
262 c.repo_info = repo_model.get_by_repo_name(repo_name)
249 if repo.stats:
263 if c.repo_info.stats:
250 last_rev = repo.stats.stat_on_revision
264 last_rev = c.repo_info.stats.stat_on_revision
251 else:
265 else:
252 last_rev = 0
266 last_rev = 0
253 c.stats_revision = last_rev
267 c.stats_revision = last_rev
@@ -257,10 +271,11 b' class ReposController(BaseController):'
257 if last_rev == 0:
271 if last_rev == 0:
258 c.stats_percentage = 0
272 c.stats_percentage = 0
259 else:
273 else:
260 c.stats_percentage = '%.2f' % ((float((last_rev)) / c.repo_last_rev) * 100)
274 c.stats_percentage = '%.2f' % ((float((last_rev)) /
275 c.repo_last_rev) * 100)
261
276
262
277
263 if not repo:
278 if not c.repo_info:
264 h.flash(_('%s repository is not mapped to db perhaps'
279 h.flash(_('%s repository is not mapped to db perhaps'
265 ' it was created or renamed from the filesystem'
280 ' it was created or renamed from the filesystem'
266 ' please run the application again'
281 ' please run the application again'
General Comments 0
You need to be logged in to leave comments. Login now