From 026074af1e85217fbcd0b5b58c931b106d0b15bd Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Thu, 25 Aug 2011 01:05:49 +0200 Subject: [PATCH] Feature/Bug #519 - CloudFilesStorage.get_file() performance issue - Fix * `CloudFilesStorage.get_file()` now guesses the filepath without connecting to cloudfiles. Huge profits for xDSL-hosted or slow net machines. --- mediagoblin/storage.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mediagoblin/storage.py b/mediagoblin/storage.py index d484be1f..7ada95e1 100644 --- a/mediagoblin/storage.py +++ b/mediagoblin/storage.py @@ -254,6 +254,8 @@ class CloudFilesStorage(StorageInterface): self.container = self.connection.get_container( self.param_container) + self.container_uri = self.container.public_uri() + def _resolve_filepath(self, filepath): return '/'.join( clean_listy_filepath(filepath)) @@ -282,7 +284,9 @@ class CloudFilesStorage(StorageInterface): self.container.delete_object(filepath) def file_url(self, filepath): - return self.get_file(filepath).public_uri() + return '/'.join([ + self.container_uri, + self._resolve_filepath(filepath)]) class MountStorage(StorageInterface): -- 2.25.1