You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2011/04/08 15:16:41 UTC
svn commit: r1090238 -
/incubator/libcloud/trunk/libcloud/storage/drivers/s3.py
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))]