aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2011-08-25 01:05:49 +0200
committerJoar Wandborg <git@wandborg.com>2011-08-25 01:05:49 +0200
commit026074af1e85217fbcd0b5b58c931b106d0b15bd (patch)
tree8b0c244543153ffb003b85a7b229ed820a9caa71
parent12c340fc07bdf576ffb6da6b5e3b525119131b3b (diff)
downloadmediagoblin-026074af1e85217fbcd0b5b58c931b106d0b15bd.tar.lz
mediagoblin-026074af1e85217fbcd0b5b58c931b106d0b15bd.tar.xz
mediagoblin-026074af1e85217fbcd0b5b58c931b106d0b15bd.zip
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.
-rw-r--r--mediagoblin/storage.py6
1 files changed, 5 insertions, 1 deletions
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):