Bug #532 - CloudFiles StorageObjectWrapper AttributeError - Fix + More
authorJoar Wandborg <git@wandborg.com>
Thu, 1 Sep 2011 22:50:13 +0000 (17:50 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 1 Sep 2011 22:50:13 +0000 (17:50 -0500)
Additionally:
Extended get_file to accept both *args and **kwargs and to
pass that further down the line to StorageObjectWrapper.
Might be useful in the future.

mediagoblin/storage.py

index 39c9eafc5112439177255a62d957463eaecd6698..6a44850cd1d7f085da59c707832256456c65c471 100644 (file)
@@ -274,7 +274,7 @@ class CloudFilesStorage(StorageInterface):
         except cloudfiles.errors.NoSuchObject:
             return False
 
-    def get_file(self, filepath, *args):
+    def get_file(self, filepath, *args, **kwargs):
         """
         - Doesn't care about the "mode" argument
         """
@@ -291,7 +291,7 @@ class CloudFilesStorage(StorageInterface):
             if mimetype:
                 obj.content_type = mimetype[0]
 
-        return self.StorageObjectWrapper(obj)
+        return StorageObjectWrapper(obj, *args, **kwargs)
 
     def delete_file(self, filepath):
         # TODO: Also delete unused directories if empty (safely, with
@@ -315,7 +315,7 @@ class StorageObjectWrapper():
     This wrapper currently meets mediagoblin's needs for a public_store
     file-like object.
     """
-    def __init__(self, storage_object):
+    def __init__(self, storage_object, *args, **kwargs):
         self.storage_object = storage_object
 
     def read(self, *args, **kwargs):