Skip to content

Commit

Permalink
Fixed issue where image attrs were not accessible. Closes gh-1.
Browse files Browse the repository at this point in the history
cloudfiles.storage_object.Object returns an object that has no tell method. Versions
Django > 1.1.x rely on the file's tell method. Since it's easy for us to grab the
position of the file I simply pointed the tell method at an internal _get_pos.
  • Loading branch information
richleland committed Jan 8, 2011
1 parent a9e05fa commit 4f35742
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cumulus/storage.py
Expand Up @@ -213,6 +213,9 @@ def __init__(self, storage, name, *args, **kwargs):
super(CloudFilesStorageFile, self).__init__(file=None, name=name,
*args, **kwargs)

def _get_pos(self):
return self._pos

def _get_size(self):
if not hasattr(self, '_size'):
self._size = self._storage.size(self.name)
Expand All @@ -226,6 +229,7 @@ def _set_size(self, size):
def _get_file(self):
if not hasattr(self, '_file'):
self._file = self._storage._get_cloud_obj(self.name)
self._file.tell = self._get_pos
return self._file

def _set_file(self, value):
Expand All @@ -246,7 +250,6 @@ def open(self, *args, **kwargs):
"""
Open the cloud file object.
"""
self.file
self._pos = 0

def close(self, *args, **kwargs):
Expand Down

0 comments on commit 4f35742

Please sign in to comment.