possibly_localize_file->localized_file... a bit less terribly long.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 12 Jun 2011 02:23:32 +0000 (21:23 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 12 Jun 2011 02:23:32 +0000 (21:23 -0500)
mediagoblin/process_media/__init__.py
mediagoblin/tests/test_workbench.py
mediagoblin/workbench.py

index 1bb43755d183a7ab373639251049a1d557c2ef70..531eb16d7f6b6b67fc9ee46c3c38b8e46059196a 100644 (file)
@@ -32,7 +32,7 @@ def process_media_initial(media_id):
         {'_id': ObjectId(media_id)})
 
     queued_filepath = entry['queued_media_file']
-    queued_filename = mg_globals.workbench_manager.possibly_localize_file(
+    queued_filename = mg_globals.workbench_manager.localized_file(
         workbench, mg_globals.queue_store, queued_filepath,
         'source')
 
index 994688c464752fc564c896f1b72723e8d2cd36a6..89f2ef337cafb1e1e0ec7727e034120eefa09c4e 100644 (file)
@@ -54,7 +54,7 @@ class TestWorkbench(object):
             self.workbench_manager.destroy_workbench,
             dont_kill_this)
 
-    def test_possibly_localize_file(self):
+    def test_localized_file(self):
         tmpdir, this_storage = get_tmp_filestorage()
         this_workbench = self.workbench_manager.create_workbench()
         
@@ -65,7 +65,7 @@ class TestWorkbench(object):
             our_file.write('Our file')
 
         # with a local file storage
-        filename = self.workbench_manager.possibly_localize_file(
+        filename = self.workbench_manager.localized_file(
             this_workbench, this_storage, filepath)
         assert filename == os.path.join(
             tmpdir, 'dir1/dir2/ourfile.txt')
@@ -77,20 +77,20 @@ class TestWorkbench(object):
         with this_storage.get_file(filepath, 'w') as our_file:
             our_file.write('Our file')
 
-        filename = self.workbench_manager.possibly_localize_file(
+        filename = self.workbench_manager.localized_file(
             this_workbench, this_storage, filepath)
         assert filename == os.path.join(
             this_workbench, 'ourfile.txt')
         
         # fake remote file storage, filename_if_copying set
-        filename = self.workbench_manager.possibly_localize_file(
+        filename = self.workbench_manager.localized_file(
             this_workbench, this_storage, filepath, 'thisfile')
         assert filename == os.path.join(
             this_workbench, 'thisfile.txt')
 
         # fake remote file storage, filename_if_copying set,
         # keep_extension_if_copying set to false
-        filename = self.workbench_manager.possibly_localize_file(
+        filename = self.workbench_manager.localized_file(
             this_workbench, this_storage, filepath, 'thisfile.text', False)
         assert filename == os.path.join(
             this_workbench, 'thisfile.text')
index 360e3e193ce43cdf1ae192be4bb7ee48998d5951..d72526235a9e651b36aa9b92f059802f72a257ce 100644 (file)
@@ -70,9 +70,9 @@ class WorkbenchManager(object):
 
         shutil.rmtree(workbench)
 
-    def possibly_localize_file(self, workbench, storage, filepath,
-                               filename_if_copying=None,
-                               keep_extension_if_copying=True):
+    def localized_file(self, workbench, storage, filepath,
+                       filename_if_copying=None,
+                       keep_extension_if_copying=True):
         """
         Possibly localize the file from this storage system (for read-only
         purposes, modifications should be written to a new file.).
@@ -93,22 +93,22 @@ class WorkbenchManager(object):
           localized_filename
 
         Examples:
-          >>> wb_manager.possibly_localize_file(
+          >>> wb_manager.localized_file(
           ...     '/our/workbench/subdir', local_storage,
           ...     ['path', 'to', 'foobar.jpg'])
           u'/local/storage/path/to/foobar.jpg'
 
-          >>> wb_manager.possibly_localize_file(
+          >>> wb_manager.localized_file(
           ...     '/our/workbench/subdir', remote_storage,
           ...     ['path', 'to', 'foobar.jpg'])
           '/our/workbench/subdir/foobar.jpg'
 
-          >>> wb_manager.possibly_localize_file(
+          >>> wb_manager.localized_file(
           ...     '/our/workbench/subdir', remote_storage,
           ...     ['path', 'to', 'foobar.jpg'], 'source.jpeg', False)
           '/our/workbench/subdir/foobar.jpeg'
 
-          >>> wb_manager.possibly_localize_file(
+          >>> wb_manager.localized_file(
           ...     '/our/workbench/subdir', remote_storage,
           ...     ['path', 'to', 'foobar.jpg'], 'source', True)
           '/our/workbench/subdir/foobar.jpg'