~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/annotate_ui.py

  • Committer: Marius Kruger
  • Date: 2008-10-01 22:23:24 UTC
  • mto: This revision was merged to the branch mainline in revision 229.
  • Revision ID: amanic@gmail.com-20081001222324-v5s94v9mhpodjpcg
remove redundant import

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
 
23
from paste.httpexceptions import HTTPBadRequest, HTTPServerError
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
 
 
36
35
class AnnotateUI (TemplatedBranchView):
37
36
 
38
37
    template_path = 'loggerhead.templates.annotate'
39
38
 
40
 
    def get_values(self, h, args, kw, response):
 
39
    def get_values(self, h, args, kw, headers):
41
40
        if len(args) > 0:
42
41
            revid = h.fix_revid(args[0])
43
42
        else:
63
62
            path = h.get_path(revid, file_id)
64
63
        filename = os.path.basename(path)
65
64
 
 
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
 
66
80
        return {
67
81
            'revid': revid,
68
82
            'file_id': file_id,
71
85
            'navigation': navigation,
72
86
            'change': h.get_changes([ revid ])[0],
73
87
            'contents': list(h.annotate_file(file_id, revid)),
 
88
            'fileview_active': True,
 
89
            'directory_breadcrumbs': directory_breadcrumbs,
 
90
            'branch_breadcrumbs': branch_breadcrumbs,
74
91
        }