##// END OF EJS Templates
cleanup: replace redirect with WebOb exceptions...
Søren Løvborg -
r5543:d9b78d8f default
parent child Browse files
Show More
@@ -28,8 +28,8 b' import formencode.htmlfill'
28 28 import traceback
29 29
30 30 from pylons import request, tmpl_context as c, url
31 from pylons.controllers.util import redirect
32 31 from pylons.i18n.translation import _
32 from webob.exc import HTTPFound
33 33
34 34 from kallithea.lib import helpers as h
35 35 from kallithea.lib.compat import formatted_json
@@ -146,4 +146,4 b' class AuthSettingsController(BaseControl'
146 146 h.flash(_('error occurred during update of auth settings'),
147 147 category='error')
148 148
149 return redirect(url('auth_home'))
149 raise HTTPFound(location=url('auth_home'))
@@ -31,8 +31,8 b' import formencode'
31 31 from formencode import htmlfill
32 32
33 33 from pylons import request, tmpl_context as c, url
34 from pylons.controllers.util import redirect
35 34 from pylons.i18n.translation import _
35 from webob.exc import HTTPFound
36 36
37 37 from kallithea.lib import helpers as h
38 38 from kallithea.lib.auth import LoginRequired, HasPermissionAllDecorator
@@ -112,7 +112,7 b' class DefaultsController(BaseController)'
112 112 h.flash(_('Error occurred during update of defaults'),
113 113 category='error')
114 114
115 return redirect(url('defaults'))
115 raise HTTPFound(location=url('defaults'))
116 116
117 117 def delete(self, id):
118 118 """DELETE /defaults/id: Delete an existing item"""
@@ -31,8 +31,8 b' import traceback'
31 31 import formencode.htmlfill
32 32
33 33 from pylons import request, response, tmpl_context as c, url
34 from pylons.controllers.util import redirect
35 34 from pylons.i18n.translation import _
35 from webob.exc import HTTPFound, HTTPNotFound, HTTPForbidden
36 36
37 37 from kallithea.model.forms import GistForm
38 38 from kallithea.model.gist import GistModel
@@ -44,7 +44,6 b' from kallithea.lib.auth import LoginRequ'
44 44 from kallithea.lib.utils import jsonify
45 45 from kallithea.lib.utils2 import safe_int, time_to_datetime
46 46 from kallithea.lib.helpers import Page
47 from webob.exc import HTTPNotFound, HTTPForbidden
48 47 from sqlalchemy.sql.expression import or_
49 48 from kallithea.lib.vcs.exceptions import VCSError, NodeNotChangedError
50 49
@@ -144,8 +143,8 b' class GistsController(BaseController):'
144 143 except Exception as e:
145 144 log.error(traceback.format_exc())
146 145 h.flash(_('Error occurred during gist creation'), category='error')
147 return redirect(url('new_gist'))
148 return redirect(url('gist', gist_id=new_gist_id))
146 raise HTTPFound(location=url('new_gist'))
147 raise HTTPFound(location=url('gist', gist_id=new_gist_id))
149 148
150 149 @LoginRequired()
151 150 @NotAnonymous()
@@ -185,7 +184,7 b' class GistsController(BaseController):'
185 184 else:
186 185 raise HTTPForbidden()
187 186
188 return redirect(url('gists'))
187 raise HTTPFound(location=url('gists'))
189 188
190 189 @LoginRequired()
191 190 def show(self, gist_id, revision='tip', format='html', f_path=None):
@@ -270,7 +269,7 b' class GistsController(BaseController):'
270 269 h.flash(_('Error occurred during update of gist %s') % gist_id,
271 270 category='error')
272 271
273 return redirect(url('gist', gist_id=gist_id))
272 raise HTTPFound(location=url('gist', gist_id=gist_id))
274 273
275 274 return rendered
276 275
@@ -32,8 +32,8 b' import formencode'
32 32 from sqlalchemy import func
33 33 from formencode import htmlfill
34 34 from pylons import request, tmpl_context as c, url
35 from pylons.controllers.util import redirect
36 35 from pylons.i18n.translation import _
36 from webob.exc import HTTPFound
37 37
38 38 from kallithea import EXTERN_TYPE_INTERNAL
39 39 from kallithea.lib import helpers as h
@@ -69,7 +69,7 b' class MyAccountController(BaseController'
69 69 if c.user.username == User.DEFAULT_USER:
70 70 h.flash(_("You can't edit this user since it's"
71 71 " crucial for entire application"), category='warning')
72 return redirect(url('users'))
72 raise HTTPFound(location=url('users'))
73 73 c.EXTERN_TYPE_INTERNAL = EXTERN_TYPE_INTERNAL
74 74
75 75 def _load_my_repos_data(self, watched=False):
@@ -144,7 +144,7 b' class MyAccountController(BaseController'
144 144 h.flash(_('Error occurred during update of user %s') \
145 145 % form_result.get('username'), category='error')
146 146 if update:
147 return redirect('my_account')
147 raise HTTPFound(location='my_account')
148 148 return htmlfill.render(
149 149 render('admin/my_account/my_account.html'),
150 150 defaults=defaults,
@@ -225,7 +225,7 b' class MyAccountController(BaseController'
225 225 log.error(traceback.format_exc())
226 226 h.flash(_('An error occurred during email saving'),
227 227 category='error')
228 return redirect(url('my_account_emails'))
228 raise HTTPFound(location=url('my_account_emails'))
229 229
230 230 def my_account_emails_delete(self):
231 231 email_id = request.POST.get('del_email_id')
@@ -233,7 +233,7 b' class MyAccountController(BaseController'
233 233 user_model.delete_extra_email(self.authuser.user_id, email_id)
234 234 Session().commit()
235 235 h.flash(_("Removed email from user"), category='success')
236 return redirect(url('my_account_emails'))
236 raise HTTPFound(location=url('my_account_emails'))
237 237
238 238 def my_account_api_keys(self):
239 239 c.active = 'api_keys'
@@ -257,7 +257,7 b' class MyAccountController(BaseController'
257 257 ApiKeyModel().create(self.authuser.user_id, description, lifetime)
258 258 Session().commit()
259 259 h.flash(_("API key successfully created"), category='success')
260 return redirect(url('my_account_api_keys'))
260 raise HTTPFound(location=url('my_account_api_keys'))
261 261
262 262 def my_account_api_keys_delete(self):
263 263 api_key = request.POST.get('del_api_key')
@@ -274,4 +274,4 b' class MyAccountController(BaseController'
274 274 Session().commit()
275 275 h.flash(_("API key successfully deleted"), category='success')
276 276
277 return redirect(url('my_account_api_keys'))
277 raise HTTPFound(location=url('my_account_api_keys'))
@@ -32,8 +32,8 b' import formencode'
32 32 from formencode import htmlfill
33 33
34 34 from pylons import request, tmpl_context as c, url
35 from pylons.controllers.util import redirect
36 35 from pylons.i18n.translation import _
36 from webob.exc import HTTPFound
37 37
38 38 from kallithea.lib import helpers as h
39 39 from kallithea.lib.auth import LoginRequired, HasPermissionAllDecorator
@@ -139,7 +139,7 b' class PermissionsController(BaseControll'
139 139 h.flash(_('Error occurred during update of permissions'),
140 140 category='error')
141 141
142 return redirect(url('admin_permissions'))
142 raise HTTPFound(location=url('admin_permissions'))
143 143
144 144 c.user = User.get_default_user()
145 145 defaults = {'anonymous': c.user.active}
@@ -33,9 +33,8 b' import itertools'
33 33 from formencode import htmlfill
34 34
35 35 from pylons import request, tmpl_context as c, url
36 from pylons.controllers.util import redirect
37 36 from pylons.i18n.translation import _, ungettext
38 from webob.exc import HTTPForbidden, HTTPNotFound, HTTPInternalServerError
37 from webob.exc import HTTPFound, HTTPForbidden, HTTPNotFound, HTTPInternalServerError
39 38
40 39 import kallithea
41 40 from kallithea.lib import helpers as h
@@ -189,10 +188,10 b' class RepoGroupsController(BaseControlle'
189 188 % request.POST.get('group_name'), category='error')
190 189 parent_group_id = form_result['group_parent_id']
191 190 #TODO: maybe we should get back to the main view, not the admin one
192 return redirect(url('repos_groups', parent_group=parent_group_id))
191 raise HTTPFound(location=url('repos_groups', parent_group=parent_group_id))
193 192 h.flash(_('Created repository group %s') % gr.group_name,
194 193 category='success')
195 return redirect(url('repos_group_home', group_name=gr.group_name))
194 raise HTTPFound(location=url('repos_group_home', group_name=gr.group_name))
196 195
197 196 def new(self):
198 197 """GET /repo_groups/new: Form to create a new item"""
@@ -266,7 +265,7 b' class RepoGroupsController(BaseControlle'
266 265 h.flash(_('Error occurred during update of repository group %s') \
267 266 % request.POST.get('group_name'), category='error')
268 267
269 return redirect(url('edit_repo_group', group_name=group_name))
268 raise HTTPFound(location=url('edit_repo_group', group_name=group_name))
270 269
271 270 @HasRepoGroupPermissionAnyDecorator('group.admin')
272 271 def delete(self, group_name):
@@ -283,13 +282,13 b' class RepoGroupsController(BaseControlle'
283 282 if repos:
284 283 h.flash(_('This group contains %s repositories and cannot be '
285 284 'deleted') % len(repos), category='warning')
286 return redirect(url('repos_groups'))
285 raise HTTPFound(location=url('repos_groups'))
287 286
288 287 children = gr.children.all()
289 288 if children:
290 289 h.flash(_('This group contains %s subgroups and cannot be deleted'
291 290 % (len(children))), category='warning')
292 return redirect(url('repos_groups'))
291 raise HTTPFound(location=url('repos_groups'))
293 292
294 293 try:
295 294 RepoGroupModel().delete(group_name)
@@ -303,8 +302,8 b' class RepoGroupsController(BaseControlle'
303 302 % group_name, category='error')
304 303
305 304 if gr.parent_group:
306 return redirect(url('repos_group_home', group_name=gr.parent_group.group_name))
307 return redirect(url('repos_groups'))
305 raise HTTPFound(location=url('repos_group_home', group_name=gr.parent_group.group_name))
306 raise HTTPFound(location=url('repos_groups'))
308 307
309 308 def show_by_name(self, group_name):
310 309 """
@@ -404,7 +403,7 b' class RepoGroupsController(BaseControlle'
404 403 if self._revoke_perms_on_yourself(form_result):
405 404 msg = _('Cannot revoke permission for yourself as admin')
406 405 h.flash(msg, category='warning')
407 return redirect(url('edit_repo_group_perms', group_name=group_name))
406 raise HTTPFound(location=url('edit_repo_group_perms', group_name=group_name))
408 407 recursive = form_result['recursive']
409 408 # iterate over all members(if in recursive mode) of this groups and
410 409 # set the permissions !
@@ -418,7 +417,7 b' class RepoGroupsController(BaseControlle'
418 417 # repo_name, self.ip_addr, self.sa)
419 418 Session().commit()
420 419 h.flash(_('Repository group permissions updated'), category='success')
421 return redirect(url('edit_repo_group_perms', group_name=group_name))
420 raise HTTPFound(location=url('edit_repo_group_perms', group_name=group_name))
422 421
423 422 @HasRepoGroupPermissionAnyDecorator('group.admin')
424 423 def delete_perms(self, group_name):
@@ -29,11 +29,10 b' import logging'
29 29 import traceback
30 30 import formencode
31 31 from formencode import htmlfill
32 from webob.exc import HTTPInternalServerError, HTTPForbidden, HTTPNotFound
33 32 from pylons import request, tmpl_context as c, url
34 from pylons.controllers.util import redirect
35 33 from pylons.i18n.translation import _
36 34 from sqlalchemy.sql.expression import func
35 from webob.exc import HTTPFound, HTTPInternalServerError, HTTPForbidden, HTTPNotFound
37 36
38 37 from kallithea.lib import helpers as h
39 38 from kallithea.lib.auth import LoginRequired, \
@@ -71,7 +70,7 b' class ReposController(BaseRepoController'
71 70
72 71 if repo_obj is None:
73 72 h.not_mapped_error(repo_name)
74 return redirect(url('repos'))
73 raise HTTPFound(location=url('repos'))
75 74
76 75 return repo_obj
77 76
@@ -152,9 +151,9 b' class ReposController(BaseRepoController'
152 151 msg = (_('Error creating repository %s')
153 152 % form_result.get('repo_name'))
154 153 h.flash(msg, category='error')
155 return redirect(url('home'))
154 raise HTTPFound(location=url('home'))
156 155
157 return redirect(h.url('repo_creating_home',
156 raise HTTPFound(location=h.url('repo_creating_home',
158 157 repo_name=form_result['repo_name_full'],
159 158 task_id=task_id))
160 159
@@ -282,7 +281,7 b' class ReposController(BaseRepoController'
282 281 log.error(traceback.format_exc())
283 282 h.flash(_('Error occurred during update of repository %s') \
284 283 % repo_name, category='error')
285 return redirect(url('edit_repo', repo_name=changed_name))
284 raise HTTPFound(location=url('edit_repo', repo_name=changed_name))
286 285
287 286 @HasRepoPermissionAllDecorator('repository.admin')
288 287 def delete(self, repo_name):
@@ -299,7 +298,7 b' class ReposController(BaseRepoController'
299 298 repo = repo_model.get_by_repo_name(repo_name)
300 299 if not repo:
301 300 h.not_mapped_error(repo_name)
302 return redirect(url('repos'))
301 raise HTTPFound(location=url('repos'))
303 302 try:
304 303 _forks = repo.forks.count()
305 304 handle_forks = None
@@ -327,8 +326,8 b' class ReposController(BaseRepoController'
327 326 category='error')
328 327
329 328 if repo.group:
330 return redirect(url('repos_group_home', group_name=repo.group.group_name))
331 return redirect(url('repos'))
329 raise HTTPFound(location=url('repos_group_home', group_name=repo.group.group_name))
330 raise HTTPFound(location=url('repos'))
332 331
333 332 @HasRepoPermissionAllDecorator('repository.admin')
334 333 def edit(self, repo_name):
@@ -372,7 +371,7 b' class ReposController(BaseRepoController'
372 371 # repo_name, self.ip_addr, self.sa)
373 372 Session().commit()
374 373 h.flash(_('Repository permissions updated'), category='success')
375 return redirect(url('edit_repo_perms', repo_name=repo_name))
374 raise HTTPFound(location=url('edit_repo_perms', repo_name=repo_name))
376 375
377 376 def edit_permissions_revoke(self, repo_name):
378 377 try:
@@ -409,7 +408,7 b' class ReposController(BaseRepoController'
409 408 c.active = 'fields'
410 409 if request.POST:
411 410
412 return redirect(url('repo_edit_fields'))
411 raise HTTPFound(location=url('repo_edit_fields'))
413 412 return render('admin/repos/repo_edit.html')
414 413
415 414 @HasRepoPermissionAllDecorator('repository.admin')
@@ -431,7 +430,7 b' class ReposController(BaseRepoController'
431 430 if isinstance(e, formencode.Invalid):
432 431 msg += ". " + e.msg
433 432 h.flash(msg, category='error')
434 return redirect(url('edit_repo_fields', repo_name=repo_name))
433 raise HTTPFound(location=url('edit_repo_fields', repo_name=repo_name))
435 434
436 435 @HasRepoPermissionAllDecorator('repository.admin')
437 436 def delete_repo_field(self, repo_name, field_id):
@@ -443,7 +442,7 b' class ReposController(BaseRepoController'
443 442 log.error(traceback.format_exc())
444 443 msg = _('An error occurred during removal of field')
445 444 h.flash(msg, category='error')
446 return redirect(url('edit_repo_fields', repo_name=repo_name))
445 raise HTTPFound(location=url('edit_repo_fields', repo_name=repo_name))
447 446
448 447 @HasRepoPermissionAllDecorator('repository.admin')
449 448 def edit_advanced(self, repo_name):
@@ -468,7 +467,7 b' class ReposController(BaseRepoController'
468 467
469 468 c.active = 'advanced'
470 469 if request.POST:
471 return redirect(url('repo_edit_advanced'))
470 raise HTTPFound(location=url('repo_edit_advanced'))
472 471 return htmlfill.render(
473 472 render('admin/repos/repo_edit.html'),
474 473 defaults=defaults,
@@ -495,7 +494,7 b' class ReposController(BaseRepoController'
495 494 h.flash(_('An error occurred during setting this'
496 495 ' repository in public journal'),
497 496 category='error')
498 return redirect(url('edit_repo_advanced', repo_name=repo_name))
497 raise HTTPFound(location=url('edit_repo_advanced', repo_name=repo_name))
499 498
500 499
501 500 @HasRepoPermissionAllDecorator('repository.admin')
@@ -521,7 +520,7 b' class ReposController(BaseRepoController'
521 520 h.flash(_('An error occurred during this operation'),
522 521 category='error')
523 522
524 return redirect(url('edit_repo_advanced', repo_name=repo_name))
523 raise HTTPFound(location=url('edit_repo_advanced', repo_name=repo_name))
525 524
526 525 @HasRepoPermissionAllDecorator('repository.admin')
527 526 def edit_advanced_locking(self, repo_name):
@@ -542,7 +541,7 b' class ReposController(BaseRepoController'
542 541 log.error(traceback.format_exc())
543 542 h.flash(_('An error occurred during unlocking'),
544 543 category='error')
545 return redirect(url('edit_repo_advanced', repo_name=repo_name))
544 raise HTTPFound(location=url('edit_repo_advanced', repo_name=repo_name))
546 545
547 546 @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin')
548 547 def toggle_locking(self, repo_name):
@@ -567,7 +566,7 b' class ReposController(BaseRepoController'
567 566 log.error(traceback.format_exc())
568 567 h.flash(_('An error occurred during unlocking'),
569 568 category='error')
570 return redirect(url('summary_home', repo_name=repo_name))
569 raise HTTPFound(location=url('summary_home', repo_name=repo_name))
571 570
572 571 @HasRepoPermissionAllDecorator('repository.admin')
573 572 def edit_caches(self, repo_name):
@@ -586,7 +585,7 b' class ReposController(BaseRepoController'
586 585 h.flash(_('An error occurred during cache invalidation'),
587 586 category='error')
588 587
589 return redirect(url('edit_repo_caches', repo_name=c.repo_name))
588 raise HTTPFound(location=url('edit_repo_caches', repo_name=c.repo_name))
590 589 return render('admin/repos/repo_edit.html')
591 590
592 591 @HasRepoPermissionAllDecorator('repository.admin')
@@ -603,7 +602,7 b' class ReposController(BaseRepoController'
603 602 log.error(traceback.format_exc())
604 603 h.flash(_('An error occurred during pull from remote location'),
605 604 category='error')
606 return redirect(url('edit_repo_remote', repo_name=c.repo_name))
605 raise HTTPFound(location=url('edit_repo_remote', repo_name=c.repo_name))
607 606 return render('admin/repos/repo_edit.html')
608 607
609 608 @HasRepoPermissionAllDecorator('repository.admin')
@@ -636,6 +635,6 b' class ReposController(BaseRepoController'
636 635 log.error(traceback.format_exc())
637 636 h.flash(_('An error occurred during deletion of repository stats'),
638 637 category='error')
639 return redirect(url('edit_repo_statistics', repo_name=c.repo_name))
638 raise HTTPFound(location=url('edit_repo_statistics', repo_name=c.repo_name))
640 639
641 640 return render('admin/repos/repo_edit.html')
@@ -31,8 +31,8 b' import formencode'
31 31
32 32 from formencode import htmlfill
33 33 from pylons import request, tmpl_context as c, url, config
34 from pylons.controllers.util import redirect
35 34 from pylons.i18n.translation import _
35 from webob.exc import HTTPFound
36 36
37 37 from kallithea.lib import helpers as h
38 38 from kallithea.lib.auth import LoginRequired, HasPermissionAllDecorator
@@ -218,7 +218,7 b' class SettingsController(BaseController)'
218 218 for repo_name in added) or '-',
219 219 ', '.join(h.escape(safe_unicode(repo_name)) for repo_name in removed) or '-')),
220 220 category='success')
221 return redirect(url('admin_settings_mapping'))
221 raise HTTPFound(location=url('admin_settings_mapping'))
222 222
223 223 defaults = Setting.get_app_settings()
224 224 defaults.update(self._get_hg_ui_settings())
@@ -278,7 +278,7 b' class SettingsController(BaseController)'
278 278 'application settings'),
279 279 category='error')
280 280
281 return redirect(url('admin_settings_global'))
281 raise HTTPFound(location=url('admin_settings_global'))
282 282
283 283 defaults = Setting.get_app_settings()
284 284 defaults.update(self._get_hg_ui_settings())
@@ -336,7 +336,7 b' class SettingsController(BaseController)'
336 336 'visualisation settings'),
337 337 category='error')
338 338
339 return redirect(url('admin_settings_visual'))
339 raise HTTPFound(location=url('admin_settings_visual'))
340 340
341 341 defaults = Setting.get_app_settings()
342 342 defaults.update(self._get_hg_ui_settings())
@@ -359,7 +359,7 b' class SettingsController(BaseController)'
359 359 'Kallithea version: %s' % c.kallithea_version)
360 360 if not test_email:
361 361 h.flash(_('Please enter email address'), category='error')
362 return redirect(url('admin_settings_email'))
362 raise HTTPFound(location=url('admin_settings_email'))
363 363
364 364 test_email_txt_body = EmailNotificationModel()\
365 365 .get_email_tmpl(EmailNotificationModel.TYPE_DEFAULT,
@@ -374,7 +374,7 b' class SettingsController(BaseController)'
374 374 test_email_txt_body, test_email_html_body)
375 375
376 376 h.flash(_('Send email task created'), category='success')
377 return redirect(url('admin_settings_email'))
377 raise HTTPFound(location=url('admin_settings_email'))
378 378
379 379 defaults = Setting.get_app_settings()
380 380 defaults.update(self._get_hg_ui_settings())
@@ -425,7 +425,7 b' class SettingsController(BaseController)'
425 425 h.flash(_('Error occurred during hook creation'),
426 426 category='error')
427 427
428 return redirect(url('admin_settings_hooks'))
428 raise HTTPFound(location=url('admin_settings_hooks'))
429 429
430 430 defaults = Setting.get_app_settings()
431 431 defaults.update(self._get_hg_ui_settings())
@@ -449,7 +449,7 b' class SettingsController(BaseController)'
449 449 full_index = request.POST.get('full_index', False)
450 450 run_task(tasks.whoosh_index, repo_location, full_index)
451 451 h.flash(_('Whoosh reindex task scheduled'), category='success')
452 return redirect(url('admin_settings_search'))
452 raise HTTPFound(location=url('admin_settings_search'))
453 453
454 454 defaults = Setting.get_app_settings()
455 455 defaults.update(self._get_hg_ui_settings())
@@ -31,8 +31,8 b' import formencode'
31 31
32 32 from formencode import htmlfill
33 33 from pylons import request, tmpl_context as c, url, config
34 from pylons.controllers.util import redirect
35 34 from pylons.i18n.translation import _
35 from webob.exc import HTTPFound
36 36
37 37 from sqlalchemy.orm import joinedload
38 38 from sqlalchemy.sql.expression import func
@@ -163,7 +163,7 b' class UserGroupsController(BaseControlle'
163 163 h.flash(_('Error occurred during creation of user group %s') \
164 164 % request.POST.get('users_group_name'), category='error')
165 165
166 return redirect(url('users_groups'))
166 raise HTTPFound(location=url('users_groups'))
167 167
168 168 @HasPermissionAnyDecorator('hg.admin', 'hg.usergroup.create.true')
169 169 def new(self, format='html'):
@@ -224,7 +224,7 b' class UserGroupsController(BaseControlle'
224 224 h.flash(_('Error occurred during update of user group %s') \
225 225 % request.POST.get('users_group_name'), category='error')
226 226
227 return redirect(url('edit_users_group', id=id))
227 raise HTTPFound(location=url('edit_users_group', id=id))
228 228
229 229 @HasUserGroupPermissionAnyDecorator('usergroup.admin')
230 230 def delete(self, id):
@@ -246,7 +246,7 b' class UserGroupsController(BaseControlle'
246 246 log.error(traceback.format_exc())
247 247 h.flash(_('An error occurred during deletion of user group'),
248 248 category='error')
249 return redirect(url('users_groups'))
249 raise HTTPFound(location=url('users_groups'))
250 250
251 251 def show(self, id, format='html'):
252 252 """GET /user_groups/id: Show a specific item"""
@@ -312,13 +312,13 b' class UserGroupsController(BaseControlle'
312 312 form['perms_updates'])
313 313 except RepoGroupAssignmentError:
314 314 h.flash(_('Target group cannot be the same'), category='error')
315 return redirect(url('edit_user_group_perms', id=id))
315 raise HTTPFound(location=url('edit_user_group_perms', id=id))
316 316 #TODO: implement this
317 317 #action_logger(self.authuser, 'admin_changed_repo_permissions',
318 318 # repo_name, self.ip_addr, self.sa)
319 319 Session().commit()
320 320 h.flash(_('User group permissions updated'), category='success')
321 return redirect(url('edit_user_group_perms', id=id))
321 raise HTTPFound(location=url('edit_user_group_perms', id=id))
322 322
323 323 @HasUserGroupPermissionAnyDecorator('usergroup.admin')
324 324 def delete_perms(self, id):
@@ -444,7 +444,7 b' class UserGroupsController(BaseControlle'
444 444 h.flash(_('An error occurred during permissions saving'),
445 445 category='error')
446 446
447 return redirect(url('edit_user_group_default_perms', id=id))
447 raise HTTPFound(location=url('edit_user_group_default_perms', id=id))
448 448
449 449 @HasUserGroupPermissionAnyDecorator('usergroup.admin')
450 450 def edit_advanced(self, id):
@@ -31,10 +31,9 b' import formencode'
31 31
32 32 from formencode import htmlfill
33 33 from pylons import request, tmpl_context as c, url, config
34 from pylons.controllers.util import redirect
35 34 from pylons.i18n.translation import _
36 35 from sqlalchemy.sql.expression import func
37 from webob.exc import HTTPNotFound
36 from webob.exc import HTTPFound, HTTPNotFound
38 37
39 38 import kallithea
40 39 from kallithea.lib.exceptions import DefaultUserException, \
@@ -148,7 +147,7 b' class UsersController(BaseController):'
148 147 log.error(traceback.format_exc())
149 148 h.flash(_('Error occurred during creation of user %s') \
150 149 % request.POST.get('username'), category='error')
151 return redirect(url('users'))
150 raise HTTPFound(location=url('users'))
152 151
153 152 def new(self, format='html'):
154 153 """GET /users/new: Form to create a new item"""
@@ -201,7 +200,7 b' class UsersController(BaseController):'
201 200 log.error(traceback.format_exc())
202 201 h.flash(_('Error occurred during update of user %s') \
203 202 % form_result.get('username'), category='error')
204 return redirect(url('edit_user', id=id))
203 raise HTTPFound(location=url('edit_user', id=id))
205 204
206 205 def delete(self, id):
207 206 """DELETE /users/id: Delete an existing item"""
@@ -222,7 +221,7 b' class UsersController(BaseController):'
222 221 log.error(traceback.format_exc())
223 222 h.flash(_('An error occurred during deletion of user'),
224 223 category='error')
225 return redirect(url('users'))
224 raise HTTPFound(location=url('users'))
226 225
227 226 def show(self, id, format='html'):
228 227 """GET /users/id: Show a specific item"""
@@ -306,7 +305,7 b' class UsersController(BaseController):'
306 305 ApiKeyModel().create(c.user.user_id, description, lifetime)
307 306 Session().commit()
308 307 h.flash(_("API key successfully created"), category='success')
309 return redirect(url('edit_user_api_keys', id=c.user.user_id))
308 raise HTTPFound(location=url('edit_user_api_keys', id=c.user.user_id))
310 309
311 310 def delete_api_key(self, id):
312 311 c.user = self._get_user_or_raise_if_default(id)
@@ -324,7 +323,7 b' class UsersController(BaseController):'
324 323 Session().commit()
325 324 h.flash(_("API key successfully deleted"), category='success')
326 325
327 return redirect(url('edit_user_api_keys', id=c.user.user_id))
326 raise HTTPFound(location=url('edit_user_api_keys', id=c.user.user_id))
328 327
329 328 def update_account(self, id):
330 329 pass
@@ -387,7 +386,7 b' class UsersController(BaseController):'
387 386 log.error(traceback.format_exc())
388 387 h.flash(_('An error occurred during permissions saving'),
389 388 category='error')
390 return redirect(url('edit_user_perms', id=id))
389 raise HTTPFound(location=url('edit_user_perms', id=id))
391 390
392 391 def edit_emails(self, id):
393 392 c.user = self._get_user_or_raise_if_default(id)
@@ -420,7 +419,7 b' class UsersController(BaseController):'
420 419 log.error(traceback.format_exc())
421 420 h.flash(_('An error occurred during email saving'),
422 421 category='error')
423 return redirect(url('edit_user_emails', id=id))
422 raise HTTPFound(location=url('edit_user_emails', id=id))
424 423
425 424 def delete_email(self, id):
426 425 """DELETE /user_emails_delete/id: Delete an existing item"""
@@ -431,7 +430,7 b' class UsersController(BaseController):'
431 430 user_model.delete_extra_email(id, email_id)
432 431 Session().commit()
433 432 h.flash(_("Removed email from user"), category='success')
434 return redirect(url('edit_user_emails', id=id))
433 raise HTTPFound(location=url('edit_user_emails', id=id))
435 434
436 435 def edit_ips(self, id):
437 436 c.user = self._get_user_or_raise_if_default(id)
@@ -470,8 +469,8 b' class UsersController(BaseController):'
470 469 category='error')
471 470
472 471 if 'default_user' in request.POST:
473 return redirect(url('admin_permissions_ips'))
474 return redirect(url('edit_user_ips', id=id))
472 raise HTTPFound(location=url('admin_permissions_ips'))
473 raise HTTPFound(location=url('edit_user_ips', id=id))
475 474
476 475 def delete_ip(self, id):
477 476 """DELETE /user_ips_delete/id: Delete an existing item"""
@@ -483,5 +482,5 b' class UsersController(BaseController):'
483 482 h.flash(_("Removed IP address from user whitelist"), category='success')
484 483
485 484 if 'default_user' in request.POST:
486 return redirect(url('admin_permissions_ips'))
487 return redirect(url('edit_user_ips', id=id))
485 raise HTTPFound(location=url('admin_permissions_ips'))
486 raise HTTPFound(location=url('edit_user_ips', id=id))
@@ -29,9 +29,8 b' import logging'
29 29 import traceback
30 30
31 31 from pylons import request, url, session, tmpl_context as c
32 from pylons.controllers.util import redirect
33 32 from pylons.i18n.translation import _
34 from webob.exc import HTTPNotFound, HTTPBadRequest
33 from webob.exc import HTTPFound, HTTPNotFound, HTTPBadRequest
35 34
36 35 import kallithea.lib.helpers as h
37 36 from kallithea.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
@@ -99,8 +98,8 b' class ChangelogController(BaseRepoContro'
99 98 if request.GET.get('set'):
100 99 request.GET.pop('set', None)
101 100 if revision is None:
102 return redirect(url('changelog_home', repo_name=repo_name, **request.GET))
103 return redirect(url('changelog_file_home', repo_name=repo_name, revision=revision, f_path=f_path, **request.GET))
101 raise HTTPFound(location=url('changelog_home', repo_name=repo_name, **request.GET))
102 raise HTTPFound(location=url('changelog_file_home', repo_name=repo_name, revision=revision, f_path=f_path, **request.GET))
104 103
105 104 limit = 2000
106 105 default = 100
@@ -118,7 +117,7 b' class ChangelogController(BaseRepoContro'
118 117 branch_name not in c.db_repo_scm_instance.branches and
119 118 branch_name not in c.db_repo_scm_instance.closed_branches and
120 119 not revision):
121 return redirect(url('changelog_file_home', repo_name=c.repo_name,
120 raise HTTPFound(location=url('changelog_file_home', repo_name=c.repo_name,
122 121 revision=branch_name, f_path=f_path or ''))
123 122
124 123 if revision == 'tip':
@@ -140,7 +139,7 b' class ChangelogController(BaseRepoContro'
140 139 collection = cs.get_file_history(f_path)
141 140 except RepositoryError as e:
142 141 h.flash(safe_str(e), category='warning')
143 redirect(h.url('changelog_home', repo_name=repo_name))
142 raise HTTPFound(location=h.url('changelog_home', repo_name=repo_name))
144 143 collection = list(reversed(collection))
145 144 else:
146 145 collection = c.db_repo_scm_instance.get_changesets(start=0, end=revision,
@@ -155,11 +154,11 b' class ChangelogController(BaseRepoContro'
155 154 c.statuses = c.db_repo.statuses(page_revisions)
156 155 except EmptyRepositoryError as e:
157 156 h.flash(safe_str(e), category='warning')
158 return redirect(url('summary_home', repo_name=c.repo_name))
157 raise HTTPFound(location=url('summary_home', repo_name=c.repo_name))
159 158 except (RepositoryError, ChangesetDoesNotExistError, Exception) as e:
160 159 log.error(traceback.format_exc())
161 160 h.flash(safe_str(e), category='error')
162 return redirect(url('changelog_home', repo_name=c.repo_name))
161 raise HTTPFound(location=url('changelog_home', repo_name=c.repo_name))
163 162
164 163 c.branch_name = branch_name
165 164 c.branch_filters = [('', _('None'))] + \
@@ -29,13 +29,12 b' Original author and date, and relevant c'
29 29 import logging
30 30 import traceback
31 31 from collections import defaultdict
32 from webob.exc import HTTPForbidden, HTTPBadRequest, HTTPNotFound
33 32
34 33 from pylons import tmpl_context as c, request, response
35 34 from pylons.i18n.translation import _
36 from pylons.controllers.util import redirect
35 from webob.exc import HTTPFound, HTTPForbidden, HTTPBadRequest, HTTPNotFound
36
37 37 from kallithea.lib.utils import jsonify
38
39 38 from kallithea.lib.vcs.exceptions import RepositoryError, \
40 39 ChangesetDoesNotExistError
41 40
@@ -383,7 +382,7 b' class ChangesetController(BaseRepoContro'
383 382 msg = _('Changing status on a changeset associated with '
384 383 'a closed pull request is not allowed')
385 384 h.flash(msg, category='warning')
386 return redirect(h.url('changeset_home', repo_name=repo_name,
385 raise HTTPFound(location=h.url('changeset_home', repo_name=repo_name,
387 386 revision=revision))
388 387 action_logger(self.authuser,
389 388 'user_commented_revision:%s' % revision,
@@ -392,7 +391,7 b' class ChangesetController(BaseRepoContro'
392 391 Session().commit()
393 392
394 393 if not request.environ.get('HTTP_X_PARTIAL_XHR'):
395 return redirect(h.url('changeset_home', repo_name=repo_name,
394 raise HTTPFound(location=h.url('changeset_home', repo_name=repo_name,
396 395 revision=revision))
397 396 #only ajax below
398 397 data = {
@@ -30,10 +30,9 b' Original author and date, and relevant c'
30 30 import logging
31 31 import re
32 32
33 from webob.exc import HTTPBadRequest
34 33 from pylons import request, tmpl_context as c, url
35 from pylons.controllers.util import redirect
36 34 from pylons.i18n.translation import _
35 from webob.exc import HTTPFound, HTTPBadRequest
37 36
38 37 from kallithea.lib.utils2 import safe_str
39 38 from kallithea.lib.vcs.utils.hgcompat import unionrepo
@@ -207,19 +206,19 b' class CompareController(BaseRepoControll'
207 206 msg = 'Could not find org repo %s' % org_repo
208 207 log.error(msg)
209 208 h.flash(msg, category='error')
210 return redirect(url('compare_home', repo_name=c.repo_name))
209 raise HTTPFound(location=url('compare_home', repo_name=c.repo_name))
211 210
212 211 if other_repo is None:
213 212 msg = 'Could not find other repo %s' % other_repo
214 213 log.error(msg)
215 214 h.flash(msg, category='error')
216 return redirect(url('compare_home', repo_name=c.repo_name))
215 raise HTTPFound(location=url('compare_home', repo_name=c.repo_name))
217 216
218 217 if org_repo.scm_instance.alias != other_repo.scm_instance.alias:
219 218 msg = 'compare of two different kind of remote repos not available'
220 219 log.error(msg)
221 220 h.flash(msg, category='error')
222 return redirect(url('compare_home', repo_name=c.repo_name))
221 raise HTTPFound(location=url('compare_home', repo_name=c.repo_name))
223 222
224 223 c.a_rev = self._get_ref_rev(org_repo, org_ref_type, org_ref_name,
225 224 returnempty=True)
@@ -33,9 +33,9 b' import shutil'
33 33
34 34 from pylons import request, response, tmpl_context as c, url
35 35 from pylons.i18n.translation import _
36 from pylons.controllers.util import redirect
36 from webob.exc import HTTPFound
37
37 38 from kallithea.lib.utils import jsonify, action_logger
38
39 39 from kallithea.lib import diffs
40 40 from kallithea.lib import helpers as h
41 41
@@ -306,7 +306,7 b' class FilesController(BaseRepoController'
306 306 % (h.person_by_id(repo.locked[0]),
307 307 h.fmt_date(h.time_to_datetime(repo.locked[1]))),
308 308 'warning')
309 return redirect(h.url('files_home',
309 raise HTTPFound(location=h.url('files_home',
310 310 repo_name=repo_name, revision='tip'))
311 311
312 312 # check if revision is a branch identifier- basically we cannot
@@ -316,7 +316,7 b' class FilesController(BaseRepoController'
316 316 if revision not in _branches.keys() + _branches.values():
317 317 h.flash(_('You can only delete files with revision '
318 318 'being a valid branch '), category='warning')
319 return redirect(h.url('files_home',
319 raise HTTPFound(location=h.url('files_home',
320 320 repo_name=repo_name, revision='tip',
321 321 f_path=f_path))
322 322
@@ -352,7 +352,7 b' class FilesController(BaseRepoController'
352 352 except Exception:
353 353 log.error(traceback.format_exc())
354 354 h.flash(_('Error occurred during commit'), category='error')
355 return redirect(url('changeset_home',
355 raise HTTPFound(location=url('changeset_home',
356 356 repo_name=c.repo_name, revision='tip'))
357 357
358 358 return render('files/files_delete.html')
@@ -366,7 +366,7 b' class FilesController(BaseRepoController'
366 366 % (h.person_by_id(repo.locked[0]),
367 367 h.fmt_date(h.time_to_datetime(repo.locked[1]))),
368 368 'warning')
369 return redirect(h.url('files_home',
369 raise HTTPFound(location=h.url('files_home',
370 370 repo_name=repo_name, revision='tip'))
371 371
372 372 # check if revision is a branch identifier- basically we cannot
@@ -376,7 +376,7 b' class FilesController(BaseRepoController'
376 376 if revision not in _branches.keys() + _branches.values():
377 377 h.flash(_('You can only edit files with revision '
378 378 'being a valid branch '), category='warning')
379 return redirect(h.url('files_home',
379 raise HTTPFound(location=h.url('files_home',
380 380 repo_name=repo_name, revision='tip',
381 381 f_path=f_path))
382 382
@@ -386,7 +386,7 b' class FilesController(BaseRepoController'
386 386 c.file = self.__get_filenode(c.cs, f_path)
387 387
388 388 if c.file.is_binary:
389 return redirect(url('files_home', repo_name=c.repo_name,
389 raise HTTPFound(location=url('files_home', repo_name=c.repo_name,
390 390 revision=c.cs.raw_id, f_path=f_path))
391 391 c.default_message = _('Edited file %s via Kallithea') % (f_path)
392 392 c.f_path = f_path
@@ -405,7 +405,7 b' class FilesController(BaseRepoController'
405 405
406 406 if content == old_content:
407 407 h.flash(_('No changes'), category='warning')
408 return redirect(url('changeset_home', repo_name=c.repo_name,
408 raise HTTPFound(location=url('changeset_home', repo_name=c.repo_name,
409 409 revision='tip'))
410 410 try:
411 411 self.scm_model.commit_change(repo=c.db_repo_scm_instance,
@@ -418,7 +418,7 b' class FilesController(BaseRepoController'
418 418 except Exception:
419 419 log.error(traceback.format_exc())
420 420 h.flash(_('Error occurred during commit'), category='error')
421 return redirect(url('changeset_home',
421 raise HTTPFound(location=url('changeset_home',
422 422 repo_name=c.repo_name, revision='tip'))
423 423
424 424 return render('files/files_edit.html')
@@ -433,7 +433,7 b' class FilesController(BaseRepoController'
433 433 % (h.person_by_id(repo.locked[0]),
434 434 h.fmt_date(h.time_to_datetime(repo.locked[1]))),
435 435 'warning')
436 return redirect(h.url('files_home',
436 raise HTTPFound(location=h.url('files_home',
437 437 repo_name=repo_name, revision='tip'))
438 438
439 439 r_post = request.POST
@@ -462,11 +462,11 b' class FilesController(BaseRepoController'
462 462
463 463 if not content:
464 464 h.flash(_('No content'), category='warning')
465 return redirect(url('changeset_home', repo_name=c.repo_name,
465 raise HTTPFound(location=url('changeset_home', repo_name=c.repo_name,
466 466 revision='tip'))
467 467 if not filename:
468 468 h.flash(_('No filename'), category='warning')
469 return redirect(url('changeset_home', repo_name=c.repo_name,
469 raise HTTPFound(location=url('changeset_home', repo_name=c.repo_name,
470 470 revision='tip'))
471 471 #strip all crap out of file, just leave the basename
472 472 filename = os.path.basename(filename)
@@ -492,14 +492,14 b' class FilesController(BaseRepoController'
492 492 except NonRelativePathError as e:
493 493 h.flash(_('Location must be relative path and must not '
494 494 'contain .. in path'), category='warning')
495 return redirect(url('changeset_home', repo_name=c.repo_name,
495 raise HTTPFound(location=url('changeset_home', repo_name=c.repo_name,
496 496 revision='tip'))
497 497 except (NodeError, NodeAlreadyExistsError) as e:
498 498 h.flash(_(e), category='error')
499 499 except Exception:
500 500 log.error(traceback.format_exc())
501 501 h.flash(_('Error occurred during commit'), category='error')
502 return redirect(url('changeset_home',
502 raise HTTPFound(location=url('changeset_home',
503 503 repo_name=c.repo_name, revision='tip'))
504 504
505 505 return render('files/files_add.html')
@@ -620,7 +620,7 b' class FilesController(BaseRepoController'
620 620 _url = url('files_home', repo_name=c.repo_name,
621 621 revision=diff1, f_path=c.f_path)
622 622
623 return redirect(_url)
623 raise HTTPFound(location=_url)
624 624 try:
625 625 if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]:
626 626 c.changeset_1 = c.db_repo_scm_instance.get_changeset(diff1)
@@ -655,7 +655,7 b' class FilesController(BaseRepoController'
655 655 node2 = FileNode(f_path, '', changeset=c.changeset_2)
656 656 except (RepositoryError, NodeError):
657 657 log.error(traceback.format_exc())
658 return redirect(url('files_home', repo_name=c.repo_name,
658 raise HTTPFound(location=url('files_home', repo_name=c.repo_name,
659 659 f_path=f_path))
660 660
661 661 if c.action == 'download':
@@ -31,8 +31,8 b' import traceback'
31 31 from formencode import htmlfill
32 32
33 33 from pylons import tmpl_context as c, request, url
34 from pylons.controllers.util import redirect
35 34 from pylons.i18n.translation import _
35 from webob.exc import HTTPFound
36 36
37 37 import kallithea.lib.helpers as h
38 38
@@ -77,7 +77,7 b' class ForksController(BaseRepoController'
77 77
78 78 if c.repo_info is None:
79 79 h.not_mapped_error(repo_name)
80 return redirect(url('repos'))
80 raise HTTPFound(location=url('repos'))
81 81
82 82 c.default_user_id = User.get_default_user().user_id
83 83 c.in_public_journal = UserFollowing.query()\
@@ -137,7 +137,7 b' class ForksController(BaseRepoController'
137 137 c.repo_info = Repository.get_by_repo_name(repo_name)
138 138 if not c.repo_info:
139 139 h.not_mapped_error(repo_name)
140 return redirect(url('home'))
140 raise HTTPFound(location=url('home'))
141 141
142 142 defaults = self.__load_data(repo_name)
143 143
@@ -186,6 +186,6 b' class ForksController(BaseRepoController'
186 186 h.flash(_('An error occurred during repository forking %s') %
187 187 repo_name, category='error')
188 188
189 return redirect(h.url('repo_creating_home',
189 raise HTTPFound(location=h.url('repo_creating_home',
190 190 repo_name=form_result['repo_name_full'],
191 191 task_id=task_id))
@@ -31,10 +31,9 b' import re'
31 31 import formencode
32 32
33 33 from formencode import htmlfill
34 from pylons.i18n.translation import _
35 from pylons import request, session, tmpl_context as c, url
34 36 from webob.exc import HTTPFound, HTTPBadRequest
35 from pylons.i18n.translation import _
36 from pylons.controllers.util import redirect
37 from pylons import request, session, tmpl_context as c, url
38 37
39 38 import kallithea.lib.helpers as h
40 39 from kallithea.lib.auth import AuthUser, HasPermissionAnyDecorator
@@ -152,7 +151,7 b' class LoginController(BaseController):'
152 151 h.flash(_('You have successfully registered into Kallithea'),
153 152 category='success')
154 153 Session().commit()
155 return redirect(url('login_home'))
154 raise HTTPFound(location=url('login_home'))
156 155
157 156 except formencode.Invalid as errors:
158 157 return htmlfill.render(
@@ -196,7 +195,7 b' class LoginController(BaseController):'
196 195 redirect_link = UserModel().send_reset_password_email(form_result)
197 196 h.flash(_('A password reset confirmation code has been sent'),
198 197 category='success')
199 return redirect(redirect_link)
198 raise HTTPFound(location=redirect_link)
200 199
201 200 except formencode.Invalid as errors:
202 201 return htmlfill.render(
@@ -249,12 +248,12 b' class LoginController(BaseController):'
249 248
250 249 UserModel().reset_password(form_result['email'], form_result['password'])
251 250 h.flash(_('Successfully updated password'), category='success')
252 return redirect(url('login_home'))
251 raise HTTPFound(location=url('login_home'))
253 252
254 253 def logout(self):
255 254 session.delete()
256 255 log.info('Logging out and deleting session for user')
257 redirect(url('home'))
256 raise HTTPFound(location=url('home'))
258 257
259 258 def authentication_token(self):
260 259 """Return the CSRF protection token for the session - just like it
@@ -30,11 +30,9 b' import traceback'
30 30 import formencode
31 31 import re
32 32
33 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPBadRequest
34
35 33 from pylons import request, tmpl_context as c, url
36 from pylons.controllers.util import redirect
37 34 from pylons.i18n.translation import _
35 from webob.exc import HTTPFound, HTTPNotFound, HTTPForbidden, HTTPBadRequest
38 36
39 37 from kallithea.lib.vcs.utils.hgcompat import unionrepo
40 38 from kallithea.lib.compat import json
@@ -237,7 +235,7 b' class PullrequestsController(BaseRepoCon'
237 235 except EmptyRepositoryError as e:
238 236 h.flash(h.literal(_('There are no changesets yet')),
239 237 category='warning')
240 redirect(url('summary_home', repo_name=org_repo.repo_name))
238 raise HTTPFound(location=url('summary_home', repo_name=org_repo.repo_name))
241 239
242 240 org_rev = request.GET.get('rev_end')
243 241 # rev_start is not directly useful - its parent could however be used
@@ -369,9 +367,9 b' class PullrequestsController(BaseRepoCon'
369 367 h.flash(_('Error occurred while creating pull request'),
370 368 category='error')
371 369 log.error(traceback.format_exc())
372 return redirect(url('pullrequest_home', repo_name=repo_name))
370 raise HTTPFound(location=url('pullrequest_home', repo_name=repo_name))
373 371
374 return redirect(pull_request.url())
372 raise HTTPFound(location=pull_request.url())
375 373
376 374 def create_update(self, old_pull_request, updaterev, title, description, reviewers_ids):
377 375 org_repo = RepoModel()._get_repo(old_pull_request.org_repo.repo_name)
@@ -456,7 +454,7 b' class PullrequestsController(BaseRepoCon'
456 454 h.flash(_('Error occurred while creating pull request'),
457 455 category='error')
458 456 log.error(traceback.format_exc())
459 return redirect(old_pull_request.url())
457 raise HTTPFound(location=old_pull_request.url())
460 458
461 459 ChangesetCommentsModel().create(
462 460 text=_('Closed, replaced by %s .') % pull_request.url(canonical=True),
@@ -470,7 +468,7 b' class PullrequestsController(BaseRepoCon'
470 468 h.flash(_('Pull request update created'),
471 469 category='success')
472 470
473 return redirect(pull_request.url())
471 raise HTTPFound(location=pull_request.url())
474 472
475 473 # pullrequest_post for PR editing
476 474 @LoginRequired()
@@ -513,7 +511,7 b' class PullrequestsController(BaseRepoCon'
513 511 Session().commit()
514 512 h.flash(_('Pull request updated'), category='success')
515 513
516 return redirect(pull_request.url())
514 raise HTTPFound(location=pull_request.url())
517 515
518 516 @LoginRequired()
519 517 @NotAnonymous()
@@ -528,7 +526,7 b' class PullrequestsController(BaseRepoCon'
528 526 Session().commit()
529 527 h.flash(_('Successfully deleted pull request'),
530 528 category='success')
531 return redirect(url('my_pullrequests'))
529 raise HTTPFound(location=url('my_pullrequests'))
532 530 raise HTTPForbidden()
533 531
534 532 @LoginRequired()
@@ -762,7 +760,7 b' class PullrequestsController(BaseRepoCon'
762 760 Session().commit()
763 761
764 762 if not request.environ.get('HTTP_X_PARTIAL_XHR'):
765 return redirect(pull_request.url())
763 raise HTTPFound(location=pull_request.url())
766 764
767 765 data = {
768 766 'target_id': h.safeid(h.safe_unicode(request.POST.get('f_path'))),
@@ -35,13 +35,12 b' import collections'
35 35 from decorator import decorator
36 36
37 37 from pylons import url, request, session
38 from pylons.controllers.util import redirect
39 38 from pylons.i18n.translation import _
40 39 from webhelpers.pylonslib import secure_form
41 40 from sqlalchemy import or_
42 41 from sqlalchemy.orm.exc import ObjectDeletedError
43 42 from sqlalchemy.orm import joinedload
44 from webob.exc import HTTPBadRequest, HTTPForbidden, HTTPMethodNotAllowed
43 from webob.exc import HTTPFound, HTTPBadRequest, HTTPForbidden, HTTPMethodNotAllowed
45 44
46 45 from kallithea import __platform__, is_windows, is_unix
47 46 from kallithea.lib.vcs.utils.lazy import LazyProperty
@@ -717,7 +716,7 b' def redirect_to_login(message=None):'
717 716 if message:
718 717 h.flash(h.literal(message), category='warning')
719 718 log.debug('Redirecting to login page, origin: %s', p)
720 return redirect(url('login_home', came_from=p))
719 raise HTTPFound(location=url('login_home', came_from=p))
721 720
722 721
723 722 class LoginRequired(object):
@@ -40,7 +40,6 b' import paste.httpheaders'
40 40
41 41 from pylons import config, tmpl_context as c, request, session, url
42 42 from pylons.controllers import WSGIController
43 from pylons.controllers.util import redirect
44 43 from pylons.templating import render_mako as render # don't remove this import
45 44 from pylons.i18n.translation import _
46 45
@@ -479,7 +478,7 b' class BaseRepoController(BaseController)'
479 478 if route in ['repo_creating_home']:
480 479 return
481 480 check_url = url('repo_creating_home', repo_name=c.repo_name)
482 return redirect(check_url)
481 raise webob.exc.HTTPFound(location=check_url)
483 482
484 483 dbr = c.db_repo = _dbr
485 484 c.db_repo_scm_instance = c.db_repo.scm_instance
General Comments 0
You need to be logged in to leave comments. Login now