Revision 4732ed31 pithos/api/util.py

b/pithos/api/util.py
48 48
from django.core.files.uploadedfile import UploadedFile
49 49

  
50 50
from pithos.lib.compat import parse_http_date_safe, parse_http_date
51
from pithos.lib.hashmap import HashMap
52 51

  
53 52
from pithos.api.faults import (Fault, NotModified, BadRequest, Unauthorized, Forbidden, ItemNotFound,
54 53
                                Conflict, LengthRequired, PreconditionFailed, RequestEntityTooLarge,
......
180 179
    return meta, get_sharing(request), get_public(request)
181 180

  
182 181
def put_object_headers(response, meta, restricted=False):
183
    response['ETag'] = meta['ETag'] if 'ETag' in meta else meta['hash']
182
    if 'ETag' in meta:
183
        response['ETag'] = meta['ETag']
184 184
    response['Content-Length'] = meta['bytes']
185 185
    response['Content-Type'] = meta.get('Content-Type', 'application/octet-stream')
186 186
    response['Last-Modified'] = http_date(int(meta['modified']))
......
742 742
        hashmap.append(request.backend.put_block(('\x00' * bo) + data[:bl]))
743 743
    return bl # Return ammount of data written.
744 744

  
745
#def hashmap_hash(request, hashmap):
746
#    """Produce the root hash, treating the hashmap as a Merkle-like tree."""
747
#    
748
#    map = HashMap(request.backend.block_size, request.backend.hash_algorithm)
749
#    map.extend([unhexlify(x) for x in hashmap])
750
#    return hexlify(map.hash())
751

  
752 745
def hashmap_md5(request, hashmap, size):
753 746
    """Produce the MD5 sum from the data in the hashmap."""
754 747
    

Also available in: Unified diff