Ticket #8143: lastsha.diff
File lastsha.diff, 1.0 KB (added by , 16 years ago) |
---|
-
tests/regressiontests/file_uploads/views.py
1 1 import os 2 import sha3 2 from django.core.files.uploadedfile import UploadedFile 4 3 from django.http import HttpResponse, HttpResponseServerError 5 4 from django.utils import simplejson 6 5 from uploadhandler import QuotaUploadHandler 6 from django.utils.hashcompat import sha_constructor 7 7 8 8 def file_upload_view(request): 9 9 """ … … 39 39 continue 40 40 submitted_hash = form_data[key + '_hash'] 41 41 if isinstance(value, UploadedFile): 42 new_hash = sha .new(value.read()).hexdigest()42 new_hash = sha_constructor(value.read()).hexdigest() 43 43 else: 44 new_hash = sha .new(value).hexdigest()44 new_hash = sha_constructor(value).hexdigest() 45 45 if new_hash != submitted_hash: 46 46 return HttpResponseServerError() 47 47