Commit de1bd9f1 authored by Tom van Bussel's avatar Tom van Bussel
Browse files

Fix warnings in file upload

When uploading photos, photos were not closed after hashing their contents. A context manager which
automatically closes the files would have been nicer, but Django does not allow it.
parent 101be591
......@@ -74,6 +74,7 @@ class Photo(models.Model):
hash_sha1 = hashlib.sha1()
for chunk in iter(lambda: self.file.read(4096), b""):
hash_sha1.update(chunk)
self.file.close()
self._digest = hash_sha1.hexdigest()
class Meta:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment