Ticket #8143: lastsha.diff

File lastsha.diff, 1.0 KB (added by Karen Tracey <kmtracey@…>, 16 years ago)
  • tests/regressiontests/file_uploads/views.py

     
    11import os
    2 import sha
    32from django.core.files.uploadedfile import UploadedFile
    43from django.http import HttpResponse, HttpResponseServerError
    54from django.utils import simplejson
    65from uploadhandler import QuotaUploadHandler
     6from django.utils.hashcompat import sha_constructor
    77
    88def file_upload_view(request):
    99    """
     
    3939            continue
    4040        submitted_hash = form_data[key + '_hash']
    4141        if isinstance(value, UploadedFile):
    42             new_hash = sha.new(value.read()).hexdigest()
     42            new_hash = sha_constructor(value.read()).hexdigest()
    4343        else:
    44             new_hash = sha.new(value).hexdigest()
     44            new_hash = sha_constructor(value).hexdigest()
    4545        if new_hash != submitted_hash:
    4646            return HttpResponseServerError()
    4747
Back to Top