Beispiel #1
0
 def single(self, data_table, request, obj_id):
     service = self.table.get_object_by_id(int(obj_id))
     verb = get_enabled(service, reverse=True).lower()
     try:
         api.service_update(request, obj_id, not service.disabled)
         messages.info(request,
                       _("Service '%(service)s' has been %(verb)s.")
                         % {'service': service.type, "verb": verb})
     except Exception, e:
         LOG.exception('Exception while toggling service %s' % obj_id)
         messages.error(request,
                        _("Unable to update service '%(id)s': %(msg)s")
                        % {"id": obj_id, "msg": e})
Beispiel #2
0
 def handle(self, request, data):
     try:
         service = api.service_get(request, data['service'])
         api.service_update(request,
                            data['service'],
                            not service.disabled)
         if service.disabled:
             messages.info(request, _("Service '%s' has been enabled")
                                     % data['name'])
         else:
             messages.info(request, _("Service '%s' has been disabled")
                                     % data['name'])
     except api_exceptions.ApiException, e:
         LOG.exception('ApiException while toggling service %s' %
                   data['service'])
         messages.error(request,
                        _("Unable to update service '%(name)s': %(msg)s")
                        % {"name": data['name'], "msg": e.message})
Beispiel #3
0
 def handle(self, request, data):
     try:
         service = api.service_get(request, data['service'])
         api.service_update(request, data['service'], not service.disabled)
         if service.disabled:
             messages.info(
                 request,
                 _("Service '%s' has been enabled") % data['name'])
         else:
             messages.info(
                 request,
                 _("Service '%s' has been disabled") % data['name'])
     except api_exceptions.ApiException, e:
         LOG.exception('ApiException while toggling service %s' %
                       data['service'])
         messages.error(
             request,
             _("Unable to update service '%(name)s': %(msg)s") % {
                 "name": data['name'],
                 "msg": e.message
             })