Author: tomaz
Date: Sat Jun 9 05:55:34 2012
New Revision: 1348324
URL: http://svn.apache.org/viewvc?rev=1348324&view=rev
Log:
Reorganize methods - put ex_methods to the end of the class.
Modified:
libcloud/trunk/CHANGES
libcloud/trunk/libcloud/storage/drivers/cloudfiles.py
Modified: libcloud/trunk/CHANGES
URL:
http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1348324&r1=1348323&r2=1348324&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Sat Jun 9 05:55:34 2012
@@ -73,6 +73,10 @@ Changes with Apache Libcloud in developm
using ex_ttl keyword argument in the CloudFiles driver.
[Tomaz Muraus]
+ - Add ex_enable_static_website and ex_set_error_page method to the
+ CloudFiles driver.
+ [Tomaz Muraus]
+
Changes with Apache Libcloud 0.10.1:
*) General:
Modified: libcloud/trunk/libcloud/storage/drivers/cloudfiles.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/libcloud/storage/drivers/cloudfiles.py?rev=1348324&r1=1348323&r2=1348324&view=diff
==============================================================================
--- libcloud/trunk/libcloud/storage/drivers/cloudfiles.py (original)
+++ libcloud/trunk/libcloud/storage/drivers/cloudfiles.py Sat Jun 9 05:55:34
2012
@@ -288,42 +288,6 @@ class CloudFilesStorageDriver(StorageDri
return response.status in [ httplib.CREATED, httplib.ACCEPTED ]
- 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=False)
-
- return response.status in [ httplib.CREATED, httplib.ACCEPTED ]
-
- def ex_set_error_page(self, container, file_name='error.html'):
- """
- Set a custom error page which is displayed if file is not found and
- serving of a static website is enabled.
-
- @param file_name: Name of the object which becomes the error page.
- @type file_name: C{str}
- """
- container_name = container.name
- headers = {'X-Container-Meta-Web-Error': file_name}
-
- response = self.connection.request('/%s' % (container_name),
- method='POST',
- headers=headers,
- cdn_request=False)
-
- 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(
@@ -472,6 +436,42 @@ class CloudFilesStorageDriver(StorageDri
extra=extra,
verify_hash=verify_hash)
+ 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=False)
+
+ return response.status in [ httplib.CREATED, httplib.ACCEPTED ]
+
+ def ex_set_error_page(self, container, file_name='error.html'):
+ """
+ Set a custom error page which is displayed if file is not found and
+ serving of a static website is enabled.
+
+ @param file_name: Name of the object which becomes the error page.
+ @type file_name: C{str}
+ """
+ container_name = container.name
+ headers = {'X-Container-Meta-Web-Error': file_name}
+
+ response = self.connection.request('/%s' % (container_name),
+ method='POST',
+ headers=headers,
+ cdn_request=False)
+
+ return response.status in [ httplib.CREATED, httplib.ACCEPTED ]
+
def _upload_object_part(self, container, object_name, part_number,
iterator, verify_hash=True):