~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/download_ui.py

MergedĀ fromĀ lp:~pr0gg3d/loggerhead/annotate_comment_notpresent_812583

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
        h = self._history
38
38
 
39
39
        args = []
40
 
        while 1:
 
40
        while True:
41
41
            arg = path_info_pop(environ)
42
42
            if arg is None:
43
43
                break
44
44
            args.append(arg)
45
45
 
46
46
        if len(args) < 2:
47
 
            raise httpexceptions.HTTPMovedPermanently(self._branch.url(
48
 
                      '../changes'))
 
47
            raise httpexceptions.HTTPMovedPermanently(
 
48
                self._branch.absolute_url('/changes'))
49
49
 
50
50
        revid = h.fix_revid(args[0])
51
51
        file_id = args[1]
61
61
        encoded_filename = urllib.quote(filename.encode('utf-8'))
62
62
        headers = [
63
63
            ('Content-Type', mime_type),
64
 
            ('Content-Length', len(content)),
 
64
            ('Content-Length', str(len(content))),
65
65
            ('Content-Disposition',
66
 
             'attachment; filename*=utf-8\'\'%s' % encoded_filename),
 
66
             "attachment; filename*=utf-8''%s" % (encoded_filename,)),
67
67
            ]
68
68
        start_response('200 OK', headers)
69
69
        return [content]