'Publish or unpublish a language of a page'

@require_POST
@transaction.atomic
def unpublish(self, request, page_id, language):

    site = Site.objects.get_current()
    page = get_object_or_404(self.model, pk=page_id)
    if (not self.has_publish_permission(request, obj=page)):
        return HttpResponseForbidden(force_text(_('You    do    not    have    permission    to    unpublish    this    page')))
    if (not page.publisher_public_id):
        return HttpResponseForbidden(force_text(_('This    page    was    never    published')))
    try:
        page.unpublish(language)
        message = (_('The    %(language)s    page    "%(page)s"    was    successfully    unpublished') % {'language': get_language_object(language, site)['name'], 'page': page})
        messages.info(request, message)
        LogEntry.objects.log_action(user_id=request.user.id, content_type_id=ContentType.objects.get_for_model(Page).pk, object_id=page_id, object_repr=page.get_title(), action_flag=CHANGE, change_message=message)
    except RuntimeError:
        exc = sys.exc_info()[1]
        messages.error(request, exc.message)
    except ValidationError:
        exc = sys.exc_info()[1]
        messages.error(request, exc.message)
    path = admin_reverse('cms_page_changelist')
    if request.GET.get('redirect_language'):
        path = ('%s?language=%s&page_id=%s' % (path, request.GET.get('redirect_language'), request.GET.get('redirect_page_id')))
    return HttpResponseRedirect(path)
