예제 #1
0
 def _process(self):
     if not editing_settings.get(self.event, 'service_url'):
         return jsonify(connected=False, error=None, status=None)
     status = service_get_status(self.event)
     return jsonify(connected=True,
                    error=status['error'],
                    status=status['status'])
예제 #2
0
파일: service.py 프로젝트: javfg/indico
 def _process(self, force):
     if not editing_settings.get(self.event, 'service_url'):
         raise BadRequest('Service URL not set')
     status = service_get_status(self.event)
     notify_service = True
     if status['error']:
         if not force:
             # this only happens if the service went down between loading
             # the page and sending the disconnect request
             raise BadRequest('Cannot disconnect service')
         notify_service = False
     elif not status['status']['can_disconnect']:
         raise BadRequest('Cannot disconnect service')
     if notify_service:
         try:
             service_handle_disconnected(self.event)
         except ServiceRequestFailed as exc:
             raise ServiceUnavailable(_('Could not disconnect event from service: {}').format(exc))
     editing_settings.delete(self.event, 'service_url', 'service_token')
     return '', 204