Author: tomaz
Date: Tue Jun 5 07:00:56 2012
New Revision: 1346260
URL: http://svn.apache.org/viewvc?rev=1346260&view=rev
Log:
Add ex_enable_static_website method to the CloudFiles driver.
Modified:
libcloud/trunk/libcloud/storage/drivers/cloudfiles.py
Modified: libcloud/trunk/libcloud/storage/drivers/cloudfiles.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/libcloud/storage/drivers/cloudfiles.py?rev=1346260&r1=1346259&r2=1346260&view=diff
==============================================================================
--- libcloud/trunk/libcloud/storage/drivers/cloudfiles.py (original)
+++ libcloud/trunk/libcloud/storage/drivers/cloudfiles.py Tue Jun 5 07:00:56
2012
@@ -291,6 +291,24 @@ class CloudFilesStorageDriver(StorageDri
return False
+ def ex_enable_static_website(self, container, index_file='index.html'):
+ """
+ Enable serving a static website.
+
+ @param index_file: Name of the object which becomes an index page for
+ every sub-directory in this container.
+ @type index_file: C{str}
+ """
+ container_name = container.name
+ headers = {'X-Container-Meta-Web-Index': index_file}
+
+ response = self.connection.request('/%s' % (container_name),
+ method='POST',
+ headers=headers,
+ cdn_request=True)
+
+ return response.status in [ httplib.CREATED, httplib.ACCEPTED ]
+
def create_container(self, container_name):
container_name = self._clean_container_name(container_name)
response = self.connection.request(