Пример #1
0
 def get_object(self):
     try:
         image = saharaclient.image_get(self.request, self.kwargs["image_id"])
     except Exception:
         image = None
         msg = _("Unable to fetch the image details")
         exceptions.handle(self.request, msg)
     return image
Пример #2
0
 def get_object(self):
     try:
         image = saharaclient.image_get(self.request,
                                        self.kwargs["image_id"])
     except Exception:
         image = None
         msg = _("Unable to fetch the image details")
         exceptions.handle(self.request, msg)
     return image
Пример #3
0
    def handle(self, request, data):
        try:
            image_id = data['image_id']
            user_name = data['user_name']
            desc = data['description']
            saharaclient.image_update(request, image_id, user_name, desc)

            image_tags = json.loads(data["tags_list"])
            saharaclient.image_tags_update(request, image_id, image_tags)
            updated_image = saharaclient.image_get(request, image_id)
            messages.success(request,
                             _("Successfully updated image."))
            return updated_image
        except Exception:
            exceptions.handle(request,
                              _("Failed to update image."))
            return False