~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/annotate_ui.py

  • Committer: Michael Hudson
  • Date: 2008-06-22 23:53:25 UTC
  • Revision ID: michael.hudson@canonical.com-20080622235325-fs0yapvfxn3xhkro
make serve-branches.py executable

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import os
21
21
import posixpath
22
22
 
23
 
from paste.httpexceptions import HTTPBadRequest, HTTPServerError
 
23
from paste.httpexceptions import HTTPBadRequest
24
24
 
25
25
from loggerhead.controllers import TemplatedBranchView
26
26
from loggerhead import util
32
32
    path = posixpath.dirname(path)
33
33
    return path
34
34
 
 
35
 
35
36
class AnnotateUI (TemplatedBranchView):
36
37
 
37
38
    template_path = 'loggerhead.templates.annotate'
38
39
 
39
 
    def get_values(self, h, args, kw, headers):
 
40
    def get_values(self, h, args, kw, response):
40
41
        if len(args) > 0:
41
42
            revid = h.fix_revid(args[0])
42
43
        else:
62
63
            path = h.get_path(revid, file_id)
63
64
        filename = os.path.basename(path)
64
65
 
65
 
        # Directory Breadcrumbs
66
 
        directory_breadcrumbs = (
67
 
            util.directory_breadcrumbs(
68
 
                self._branch.friendly_name,
69
 
                self._branch.is_root,
70
 
                'files'))
71
 
 
72
 
        # Create breadcrumb trail for the path within the branch
73
 
        try:
74
 
            inv = h.get_inventory(revid)
75
 
        except:
76
 
            self.log.exception('Exception fetching changes')
77
 
            raise HTTPServerError('Could not fetch changes')
78
 
        branch_breadcrumbs = util.branch_breadcrumbs(path, inv, 'files')
79
 
 
80
66
        return {
81
67
            'revid': revid,
82
68
            'file_id': file_id,
85
71
            'navigation': navigation,
86
72
            'change': h.get_changes([ revid ])[0],
87
73
            'contents': list(h.annotate_file(file_id, revid)),
88
 
            'fileview_active': True,
89
 
            'directory_breadcrumbs': directory_breadcrumbs,
90
 
            'branch_breadcrumbs': branch_breadcrumbs,
91
74
        }