~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/diff_ui.py

  • Committer: Matt Nordhoff
  • Date: 2009-10-21 12:12:42 UTC
  • mto: This revision was merged to the branch mainline in revision 392.
  • Revision ID: mnordhoff@mattnordhoff.com-20091021121242-kcgfn810xp0a1sbf
Remove empty docstring

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008-2011 Canonical Ltd.
 
1
# Copyright (C) 2008  Canonical Ltd.
2
2
#                     (Authored by Martin Albisetti <argentina@gmail.com>)
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
17
17
#
18
18
 
19
19
from cStringIO import StringIO
 
20
import logging
20
21
import time
21
22
 
22
23
from paste.request import path_info_pop
23
24
 
24
25
from bzrlib.diff import show_diff_trees
25
 
from bzrlib.revision import NULL_REVISION
26
26
 
27
27
from loggerhead.controllers import TemplatedBranchView
28
28
 
 
29
log = logging.getLogger("loggerhead.controllers")
 
30
 
29
31
 
30
32
class DiffUI(TemplatedBranchView):
31
33
    """Class to output a diff for a single file or revisions."""
47
49
        revid_from = self._history.fix_revid(revid_from)
48
50
        change = self._history.get_changes([revid_from])[0]
49
51
 
50
 
        if len(args) == 2:
 
52
        if len(args) is 2:
51
53
            revid_to = self._history.fix_revid(args[1])
52
 
        elif len(change.parents) == 0:
53
 
            revid_to = NULL_REVISION
54
54
        else:
55
55
            revid_to = change.parents[0].revid
56
56
 
72
72
        filename = '%s_%s.diff' % (revno1, revno2)
73
73
        headers = [
74
74
            ('Content-Type', 'application/octet-stream'),
75
 
            ('Content-Length', str(len(content))),
 
75
            ('Content-Length', len(content)),
76
76
            ('Content-Disposition', 'attachment; filename=%s' % (filename,)),
77
77
            ]
78
78
        start_response('200 OK', headers)