MountStorage: Create all the wrappers
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Sat, 23 Jul 2011 13:29:22 +0000 (15:29 +0200)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 1 Aug 2011 21:50:39 +0000 (23:50 +0200)
All those methods just call the appropiate method of the
relevant backend.

mediagoblin/storage.py

index d994268b94b729231bf0b24ca389a1cb7fe2e3c6..e3d54a305ee005f78b35fed5d08c6b0670d078eb 100644 (file)
@@ -292,6 +292,34 @@ class MountStorage(StorageInterface):
         else:
             return res
 
+    def file_exists(self, filepath):
+        backend, filepath = self.resolve_to_backend(filepath)
+        return backend.file_exists(filepath)
+
+    def get_file(self, filepath, mode='r'):
+        backend, filepath = self.resolve_to_backend(filepath)
+        return backend.get_file(filepath, mode)
+
+    def delete_file(self, filepath):
+        backend, filepath = self.resolve_to_backend(filepath)
+        return backend.delete_file(filepath)
+
+    def file_url(self, filepath):
+        backend, filepath = self.resolve_to_backend(filepath)
+        return backend.file_url(filepath)
+
+    def get_local_path(self, filepath):
+        backend, filepath = self.resolve_to_backend(filepath)
+        return backend.get_local_path(filepath)
+
+    def copy_locally(self, filepath, dest_path):
+        """
+        Need to override copy_locally, because the local_storage
+        attribute is not correct.
+        """
+        backend, filepath = self.resolve_to_backend(filepath)
+        backend.copy_locally(filepath, dest_path)
+
 
 ###########
 # Utilities