Chris Beaven avatar Chris Beaven committed a6a01ef

Add a connection_kwargs argument to the CloudFilesStorage so other available arguments (like servicenet and debuglevel) are supported.

Comments (0)

Files changed (1)

backends/mosso.py

 from django.core.files import File
 from django.core.files.storage import Storage
 from django.utils.text import get_valid_filename
-import mimetypes
-
 
 try:
     import cloudfiles
     """
     default_quick_listdir = True
 
-    def __init__(self, username=None, api_key=None, container=None):
+    def __init__(self, username=None, api_key=None, container=None,
+                 connection_kwargs=None):
         """
         Initialize the settings for the connection and container.
         """
         self.username = username or settings.CLOUDFILES_USERNAME
         self.api_key = api_key or settings.CLOUDFILES_API_KEY
         self.container_name = container or settings.CLOUDFILES_CONTAINER
+        self.connection_kwargs = None or {}
 
     def __getstate__(self):
         """
         """
         return dict(username=self.username,
                     api_key=self.api_key,
-                    container_name=self.container_name)
+                    container_name=self.container_name,
+                    connection_kwargs=self.connection_kwargs)
 
     def _get_connection(self):
         if not hasattr(self, '_connection'):
             self._connection = cloudfiles.get_connection(self.username,
-                                                         self.api_key)
+                                    self.api_key, **self.connection_kwargs)
         return self._connection
 
     def _set_connection(self, value):
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.