1. Vlad Filippov
  2. django-storages


Honza Pokorny  committed 443b866

Add support for SSL in Rackspace Cloudfiles backend

Comments (0)

Files changed (2)

File docs/backends/rackspace-cloudfiles.rst Modified

View file
  • Ignore whitespace
  • Hide word diff
     CLOUDFILES_CONTAINER = 'ContainerName'
     DEFAULT_FILE_STORAGE = 'backends.mosso.CloudFilesStorage'
+    # Optional - use SSL
 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

File storages/backends/mosso.py Modified

View file
  • Ignore whitespace
  • Hide word diff
 # TODO: implement TTL into cloudfiles methods
 TTL = getattr(settings, 'CLOUDFILES_TTL', 600)
+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)