예제 #1
0
파일: views.py 프로젝트: icereval/osf.io
    def post(self, request, *args, **kwargs):
        from osf.management.commands.force_archive import archive, verify
        stuck_reg = self.get_object()
        if verify(stuck_reg):
            try:
                archive(stuck_reg)
                messages.success(request, 'Registration archive processes has restarted')
            except Exception as exc:
                messages.error(request, 'This registration cannot be unstuck due to {} '
                                        'if the problem persists get a developer to fix it.'.format(exc.__class__.__name__))

        else:
            messages.error(request, 'This registration may not technically be stuck,'
                                    ' if the problem persists get a developer to fix it.')

        return redirect(reverse_node(self.kwargs.get('guid')))
예제 #2
0
    def post(self, request, *args, **kwargs):
        from osf.management.commands.force_archive import archive, verify
        stuck_reg = self.get_object()
        if verify(stuck_reg):
            try:
                archive(stuck_reg)
                messages.success(request, 'Registration archive processes has restarted')
            except Exception as exc:
                messages.error(request, 'This registration cannot be unstuck due to {} '
                                        'if the problem persists get a developer to fix it.'.format(exc.__class__.__name__))

        else:
            messages.error(request, 'This registration may not technically be stuck,'
                                    ' if the problem persists get a developer to fix it.')

        return redirect(reverse_node(self.kwargs.get('guid')))
예제 #3
0
    def post(self, request, *args, **kwargs):
        # Prevents circular imports that cause admin app to hang at startup
        from osf.management.commands.force_archive import archive, verify
        stuck_reg = self.get_object()
        if verify(stuck_reg):
            try:
                archive(stuck_reg)
                messages.success(
                    request, 'Registration archive processes has restarted')
            except Exception as exc:
                messages.error(
                    request,
                    f'This registration cannot be unstuck due to {exc.__class__.__name__} '
                    f'if the problem persists get a developer to fix it.')
        else:
            messages.error(
                request, 'This registration may not technically be stuck,'
                ' if the problem persists get a developer to fix it.')

        return redirect(self.get_success_url())