Honza Pokorny avatar Honza Pokorny committed 443b866

Add support for SSL in Rackspace Cloudfiles backend

Comments (0)

Files changed (2)

docs/backends/rackspace-cloudfiles.rst

     CLOUDFILES_CONTAINER = 'ContainerName'
     DEFAULT_FILE_STORAGE = 'backends.mosso.CloudFilesStorage'
 
+    # Optional - use SSL
+    CLOUDFILES_SSL = True
+
 Optionally, you can implement the following custom upload_to in your models.py file. This will upload the file using the file name only to Cloud Files (e.g. 'myfile.jpg'). If you supply a string (e.g. upload_to='some/path'), your file name will include the path (e.g. 'some/path/myfile.jpg')::
 
     from backends.mosso import cloudfiles_upload_to

storages/backends/mosso.py

 # TODO: implement TTL into cloudfiles methods
 TTL = getattr(settings, 'CLOUDFILES_TTL', 600)
 CONNECTION_KWARGS = getattr(settings, 'CLOUDFILES_CONNECTION_KWARGS', {})
+SSL = getattr(settings, 'CLOUDFILES_SSL', False)
 
 
 def cloudfiles_upload_to(self, filename):
 
     def _get_container_url(self):
         if not hasattr(self, '_container_public_uri'):
-            self._container_public_uri = self.container.public_uri()
+            if SSL:
+                self._container_public_uri = self.container.public_ssl_uri()
+            else:
+                self._container_public_uri = self.container.public_uri()
         return self._container_public_uri
 
     container_url = property(_get_container_url)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.