diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-11-20 22:01:43 -0600 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-11-20 22:01:43 -0600 |
commit | 98f6efb06898dc86398a742bddbf3a06e63355d7 (patch) | |
tree | d7fbdaf42806d56ef3249ce429d71030fa910ec9 /mediagoblin/storage/__init__.py | |
parent | fe0a8f53e251aae93bee5f4dee79d462fad751e8 (diff) | |
download | mediagoblin-98f6efb06898dc86398a742bddbf3a06e63355d7.tar.lz mediagoblin-98f6efb06898dc86398a742bddbf3a06e63355d7.tar.xz mediagoblin-98f6efb06898dc86398a742bddbf3a06e63355d7.zip |
copy_local_to_storage, both general and specialized-for-BasicFileStorage versions
This utility should allow for easy copying from a local filesystem to
the storage instance.
Diffstat (limited to 'mediagoblin/storage/__init__.py')
-rw-r--r-- | mediagoblin/storage/__init__.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mediagoblin/storage/__init__.py b/mediagoblin/storage/__init__.py index 9e592b9e..b76e18af 100644 --- a/mediagoblin/storage/__init__.py +++ b/mediagoblin/storage/__init__.py @@ -169,6 +169,14 @@ class StorageInterface(object): with file(dest_path, 'wb') as dest_file: dest_file.write(source_file.read()) + def copy_local_to_storage(self, filename, filepath): + """ + Copy this file from locally to the storage system. + """ + with self.get_file(filepath, 'wb') as dest_file: + with file(filename, 'rb') as source_file: + dest_file.write(source_file.read()) + ########### # Utilities |