django-cumulus/django-cumulus — pull request #157 by izquierdo (2014-05-23 07:29:04+00:00)
Title: Fix reading files by chunks

Trying to read files by chunks hangs when there's more than one chunk. The main issue is that `self.fields.get` returns a generator and the code keeps calling it and returning the first element, instead of iterating over it.

See this comment: https://github.com/rackspace/pyrax/blob/master/pyrax/cf_wrapper/storage_object.py#L67

One undesirable property of this patch is that `chunk_size` is ignored after the first call, but I think that's better than the current behavior of hanging.

This may fix #107 and #155.

As an aside, what's your long term view regarding tests? I saw that the tests make real calls to the Cloud Files API, and they're failing in Travis because of bad credentials. I believe tests shouldn't be making real calls to an API and we should be testing with mock responses instead. Do you agree this is a good direction?