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')))
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')))
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())