On 06.10.2012, at 19:48, Dan Loewenherz <[email protected]> wrote: > Hey Jannis, > > On Mon, Oct 1, 2012 at 12:47 AM, Jannis Leidel <[email protected]> wrote: > > On 30.09.2012, at 23:41, Dan Loewenherz <[email protected]> wrote: > > > Many backends don't support last modified times, and even if they all did, > > it's incorrect to assume that last modified time is an accurate heuristic > > for whether a file has already been uploaded or not. > > Well but it's an accurate way to decide whether a file has been changed on > the filesystem, and that's what collectstatic cares about. The storage > backend *is* the API to extend that when needed, so feel free to use it. > > It's accurate *only* in certain situations. And on a distributed development > team, I've run into a lot of issues with developers re-upload files that have > already been uploaded because they just recently updated their repo. > > A checksum is the only true accurate method to determine if a file has > changed. > > Additionally, you didn't address my point that I quoted from. Storage > backends don't just reflect filesystems--they could reflect files stored in a > database, S3, etc. And some of these filesystems don't support last modified > times.
Then, frankly, this is a problem of the storage backends, not Django's. The S3BotoStorage backend *does* have a modified_time method: https://bitbucket.org/david/django-storages/src/1574890d87be/storages/backends/s3boto.py#cl-298 What storage backend do you use that doesn't have a modified_time method? > This is a bit confusing...why call it last_modified when that's doesn't > necessarily reflect what it's doing? It would be more flexible to create two > methods: It's called modified_time, not last_modified. > def modification_identifier(self): > > def has_changed(self): > > Then, any backend could implement these however they might like, and > collectstatic would have no excuse in uploading the same file more than once. > Overloading last_modified to also do things like calculate md5's seems a bit > hacky to me, and confusing for any developer maintaining a custom storage > backend that doesn't support last modified. I disagree, modified_time is perfectly capable of handling your use case. Jannis -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
