Revision 4732ed31

b/pithos/api/login.py
45 45
    users = settings.AUTHENTICATION_USERS
46 46
    host = settings.AUTHENTICATION_HOST
47 47
    if users is not None or host is None:
48
    	return HttpResponseNotFound()
48
        return HttpResponseNotFound()
49 49
    
50 50
    if request.is_secure():
51
    	proto = 'https://'
51
        proto = 'https://'
52 52
    else:
53
    	proto = 'http://'
54
	next = request.GET.get('next', '')
55
	params = {'next': next}
56
	renew = 'renew' in request.GET
57
	if renew:
58
		params['renew'] = True
53
        proto = 'http://'
54
    next = request.GET.get('next', '')
55
    params = {'next': next}
56
    renew = 'renew' in request.GET
57
    if renew:
58
        params['renew'] = True
59 59
    uri = proto + host + '/login?' + urlencode(params)
60
    return HttpResponseRedirect(uri)
60
    return HttpResponseRedirect(uri)
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
    
b/pithos/backends/lib/sqlalchemy/public.py
77 77
    def public_get(self, path):
78 78
        s = select([self.public.c.public_id])
79 79
        s = s.where(and_(self.public.c.path == path,
80
        				 self.public.c.active == True))
80
                         self.public.c.active == True))
81 81
        r = self.conn.execute(s)
82 82
        row = r.fetchone()
83 83
        r.close()
......
88 88
    def public_path(self, public):
89 89
        s = select([self.public.c.path])
90 90
        s = s.where(and_(self.public.c.public_id == public,
91
        				 self.public.c.active == True))
91
                         self.public.c.active == True))
92 92
        r = self.conn.execute(s)
93 93
        row = r.fetchone()
94 94
        r.close()

Also available in: Unified diff