498
498
#Begin with success message class, downgrade to info if problems
499
499
success_message_level = messages.success
500
500
if action_not_allowed:
501
messages.error(request, _('You do not have permission to %s: %s') %
502
(self._conjugate(action_not_allowed).lower(),
503
", ".join(action_not_allowed)))
501
msg = _('You do not have permission to %(action)s: %(objs)s')
502
params = {"action": self._conjugate(action_not_allowed).lower(),
503
"objs": ", ".join(action_not_allowed)}
504
messages.error(request, msg % params)
504
505
success_message_level = messages.info
505
506
if action_failure:
506
messages.error(request, _('Unable to %s: %s') % (
507
self._conjugate(action_failure).lower(),
508
", ".join(action_failure)))
507
msg = _('Unable to %(action)s: %(objs)s')
508
params = {"action": self._conjugate(action_failure).lower(),
509
"objs": ", ".join(action_failure)}
510
messages.error(request, msg % params)
509
511
success_message_level = messages.info
510
512
if action_success:
511
success_message_level(request, _('%s: %s') % (
512
self._conjugate(action_success, True),
513
", ".join(action_success)))
513
msg = _('%(action)s: %(objs)s')
514
params = {"action": self._conjugate(action_success, True),
515
"objs": ", ".join(action_success)}
516
success_message_level(request, msg % params)
515
518
return shortcuts.redirect(self.get_success_url(request))