##// 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 142 except formencode.Invalid, errors:
143 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 158 c.users_array = repo_model.get_users_js()
145 159 errors.value.update({'user':c.repo_info.user.username})
146 160 return htmlfill.render(
@@ -245,9 +259,9 b' class ReposController(BaseController):'
245 259 """GET /repos/repo_name/edit: Form to edit an existing item"""
246 260 # url('edit_repo', repo_name=ID)
247 261 repo_model = RepoModel()
248 c.repo_info = repo = repo_model.get_by_repo_name(repo_name)
249 if repo.stats:
250 last_rev = repo.stats.stat_on_revision
262 c.repo_info = repo_model.get_by_repo_name(repo_name)
263 if c.repo_info.stats:
264 last_rev = c.repo_info.stats.stat_on_revision
251 265 else:
252 266 last_rev = 0
253 267 c.stats_revision = last_rev
@@ -257,10 +271,11 b' class ReposController(BaseController):'
257 271 if last_rev == 0:
258 272 c.stats_percentage = 0
259 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 279 h.flash(_('%s repository is not mapped to db perhaps'
265 280 ' it was created or renamed from the filesystem'
266 281 ' please run the application again'
General Comments 0
You need to be logged in to leave comments. Login now