libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1090238 - /incubator/libcloud/trunk/libcloud/storage/drivers/s3.py
Date Fri, 08 Apr 2011 13:16:41 GMT
Author: tomaz
Date: Fri Apr  8 13:16:40 2011
New Revision: 1090238

URL: http://svn.apache.org/viewvc?rev=1090238&view=rev
Log:
Add delete_object method to the s3 driver.

Modified:
    incubator/libcloud/trunk/libcloud/storage/drivers/s3.py

Modified: incubator/libcloud/trunk/libcloud/storage/drivers/s3.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/storage/drivers/s3.py?rev=1090238&r1=1090237&r2=1090238&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/storage/drivers/s3.py (original)
+++ incubator/libcloud/trunk/libcloud/storage/drivers/s3.py Fri Apr  8 13:16:40 2011
@@ -222,6 +222,19 @@ class S3StorageDriver(StorageDriver):
 
         return False
 
+    def delete_object(self, obj):
+        # TODO: escape object and container name
+        response = self.connection.request('/%s/%s' % (obj.container.name,
+                                                       obj.name),
+                                           method='DELETE')
+        if response.status == httplib.NO_CONTENT:
+            return True
+        elif response.status == httplib.NOT_FOUND:
+            raise ObjectDoesNotExistError(value=None, driver=self,
+                                         object_name=obj.name)
+
+        return False
+
     def _to_containers(self, obj, xpath):
         return [ self._to_container(element) for element in \
                  obj.findall(fixxpath(xpath=xpath, namespace=NAMESPACE))]



Mime
View raw message