From c2c373e8d4efbf13234114e2ca343e2bed9e616d Mon Sep 17 00:00:00 2001 From: Nathan Date: Wed, 3 Nov 2010 12:39:05 -0600 Subject: Fixed 'size' function for existing files. --- django/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/__init__.py b/django/__init__.py index 9f9836c..7386594 100644 --- a/django/__init__.py +++ b/django/__init__.py @@ -1,3 +1,4 @@ +import os from django.conf import settings from amazons3 import S3 @@ -39,7 +40,6 @@ class S3Storage(Storage): return True def exists(self, filename): - import os contents = self.conn.list_bucket(self.options['bucket'], {'prefix': os.path.dirname(filename)}) if filename in [f.key for f in contents.entries]: return True @@ -47,9 +47,9 @@ class S3Storage(Storage): return False def size(self, filename): - contents = self.conn.list_bucket(self.options['bucket']) + contents = self.conn.list_bucket(self.options['bucket'], {'prefix': os.path.dirname(filename)} ) for f in contents.entries: - if f.name == filename: + if f.key == filename: return f.size return False -- cgit v1.2.1