~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/filesystem/diff/__init__.py

  • Committer: William Grant
  • Date: 2009-12-08 10:05:52 UTC
  • Revision ID: grantw@unimelb.edu.au-20091208100552-51qd6m3pl3h2owkk
Improve the diff/log breadcrumbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    '''A view to present a nice XHTML Subversion diff from a user's jail.'''
38
38
    template = 'template.html'
39
39
    tab = 'files'
 
40
    breadcrumb_text = 'Files'
40
41
 
41
42
    subpath_allowed = True
42
43
 
78
79
        )
79
80
 
80
81
        ctx['title'] = os.path.normpath(self.path).rsplit('/', 1)[-1]
81
 
        self.extra_breadcrumbs = make_path_breadcrumbs(req, self.subpath,
82
 
                                                   suffix='(Subversion diff)')
 
82
        self.extra_breadcrumbs = make_path_breadcrumbs(req, self.subpath)
 
83
        self.extra_breadcrumbs.append(SubversionDiffBreadcrumb())
83
84
 
84
85
        # Create a dict with (name, HTMLdiff) pairs for each non-empty diff.
85
86
        ctx['files'] = dict([(fd[0], genshi.XML(htmlfy_diff(fd[1])))
91
92
        return os.path.join(*self.subpath) if self.subpath else ''
92
93
 
93
94
 
 
95
class SubversionDiffBreadcrumb(object):
 
96
    text = 'Subversion Diff'
 
97
 
 
98
 
94
99
def htmlfy_diff(difftext):
95
100
    """Adds HTML markup to a udiff string"""
96
101
    output = cgi.escape(difftext)