commit d9d1763e60679cba1034cccef5def0bf3403d330
Author: Christos Stavrakakis <cstavr@grnet.gr>
Date:   Thu Apr 4 16:27:24 2013 +0300

    Use the common 'api_method' decorator in plankton
    
    Use the common 'api_method' decorator in all plankton API methods.
    Modify the 'plankton_method' decorator to only create and close
    the ImageBackend.

diff --git a/snf-cyclades-app/synnefo/plankton/views.py b/snf-cyclades-app/synnefo/plankton/views.py
index 310c3ac..a921e08 100644
--- a/snf-cyclades-app/synnefo/plankton/views.py
+++ b/snf-cyclades-app/synnefo/plankton/views.py
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2013 GRNET S.A. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
@@ -40,7 +40,9 @@ from urllib import unquote
 from django.conf import settings
 from django.http import (HttpResponse, HttpResponseNotFound,
                          HttpResponseBadRequest)
-from synnefo.plankton.util import plankton_method
+
+from snf_django.lib import api
+from synnefo.plankton.utils import plankton_method
 
 
 FILTERS = ('name', 'container_format', 'disk_format', 'status', 'size_min',
@@ -114,7 +116,8 @@ def _get_image_headers(request):
     return headers
 
 
-@plankton_method('POST')
+@api.api_method(http_method="POST", user_required=True, logger=log)
+@plankton_method
 def add_image(request):
     """Add a new virtual machine image
 
@@ -155,7 +158,8 @@ def add_image(request):
     return _create_image_response(image)
 
 
-@plankton_method("DELETE")
+@api.api_method(http_method="DELETE", user_required=True, logger=log)
+@plankton_method
 def delete_image(request, image_id):
     """Delete an Image.
 
@@ -174,7 +178,8 @@ def delete_image(request, image_id):
     return HttpResponse(status=204)
 
 
-@plankton_method('PUT')
+@api.api_method(http_method="PUT", user_required=True, logger=log)
+@plankton_method
 def add_image_member(request, image_id, member):
     """Add a member to an image
 
@@ -190,7 +195,8 @@ def add_image_member(request, image_id, member):
     return HttpResponse(status=204)
 
 
-@plankton_method('GET')
+@api.api_method(http_method="GET", user_required=True, logger=log)
+@plankton_method
 def get_image(request, image_id):
     """Retrieve a virtual machine image
 
@@ -216,7 +222,8 @@ def get_image(request, image_id):
     return HttpResponse(status=501)     # Not Implemented
 
 
-@plankton_method('HEAD')
+@api.api_method(http_method="HEAD", user_required=True, logger=log)
+@plankton_method
 def get_image_meta(request, image_id):
     """Return detailed metadata on a specific image
 
@@ -230,7 +237,8 @@ def get_image_meta(request, image_id):
     return _create_image_response(image)
 
 
-@plankton_method('GET')
+@api.api_method(http_method="GET", user_required=True, logger=log)
+@plankton_method
 def list_image_members(request, image_id):
     """List image memberships
 
@@ -244,7 +252,8 @@ def list_image_members(request, image_id):
     return HttpResponse(data)
 
 
-@plankton_method('GET')
+@api.api_method(http_method="GET", user_required=True, logger=log)
+@plankton_method
 def list_images(request, detail=False):
     """Return a list of available images.
 
@@ -297,7 +306,8 @@ def list_images(request, detail=False):
     return HttpResponse(data)
 
 
-@plankton_method('GET')
+@api.api_method(http_method="GET", user_required=True, logger=log)
+@plankton_method
 def list_shared_images(request, member):
     """Request shared images
 
@@ -320,7 +330,8 @@ def list_shared_images(request, member):
     return HttpResponse(data)
 
 
-@plankton_method('DELETE')
+@api.api_method(http_method="DELETE", user_required=True, logger=log)
+@plankton_method
 def remove_image_member(request, image_id, member):
     """Remove a member from an image
 
@@ -333,7 +344,8 @@ def remove_image_member(request, image_id, member):
     return HttpResponse(status=204)
 
 
-@plankton_method('PUT')
+@api.api_method(http_method="PUT", user_required=True, logger=log)
+@plankton_method
 def update_image(request, image_id):
     """Update an image
 
@@ -355,7 +367,8 @@ def update_image(request, image_id):
     return _create_image_response(image)
 
 
-@plankton_method('PUT')
+@api.api_method(http_method="PUT", user_required=True, logger=log)
+@plankton_method
 def update_image_members(request, image_id):
     """Replace a membership list for an image
 
