diff options
Diffstat (limited to 'mediagoblin/storage/cloudfiles.py')
-rw-r--r-- | mediagoblin/storage/cloudfiles.py | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/mediagoblin/storage/cloudfiles.py b/mediagoblin/storage/cloudfiles.py index 47c81ad6..61665ea0 100644 --- a/mediagoblin/storage/cloudfiles.py +++ b/mediagoblin/storage/cloudfiles.py @@ -143,7 +143,7 @@ class CloudFilesStorage(StorageInterface): """ # Override this method, using the "stream" iterator for efficient streaming with self.get_file(filepath, 'rb') as source_file: - with file(dest_path, 'wb') as dest_file: + with open(dest_path, 'wb') as dest_file: for data in source_file: dest_file.write(data) @@ -164,7 +164,7 @@ class CloudFilesStorage(StorageInterface): # TODO: Fixing write() still seems worthwhile though. _log.debug('Sending {0} to cloudfiles...'.format(filepath)) with self.get_file(filepath, 'wb') as dest_file: - with file(filename, 'rb') as source_file: + with open(filename, 'rb') as source_file: # Copy to storage system in 4096 byte chunks dest_file.send(source_file) @@ -193,27 +193,6 @@ class CloudFilesStorageObjectWrapper(): return self.storage_object.read(*args, **kwargs) def write(self, data, *args, **kwargs): - """ - write data to the cloudfiles storage object - - The original motivation for this wrapper is to ensure - that buffered writing to a cloudfiles storage object does not overwrite - any preexisting data. - - Currently this method does not support any write modes except "append". - However if we should need it it would be easy implement. - """ - _log.warn( - '{0}.write() has bad performance! Use .send instead for now'\ - .format(self.__class__.__name__)) - - if self.storage_object.size and type(data) == str: - _log.debug('{0} is > 0 in size, appending data'.format( - self.storage_object.name)) - data = self.read() + data - - _log.debug('Writing {0}'.format( - self.storage_object.name)) self.storage_object.write(data, *args, **kwargs) def send(self, *args, **kw): |