~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/annotate_ui.py

  • Committer: Robey Pointer
  • Date: 2006-12-20 09:29:42 UTC
  • Revision ID: robey@lag.net-20061220092942-4jte8hob9sq1h93y
the big migration of branch-specific data to a BranchView object: actually
not so bad.  now all branch config is in a sub-object.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
        
42
42
class AnnotateUI (object):
43
43
 
 
44
    def __init__(self, branch):
 
45
        # BranchView object
 
46
        self._branch = branch
 
47
        self.log = branch.log
 
48
 
44
49
    @turbogears.expose(html='loggerhead.templates.annotate')
45
50
    def default(self, *args, **kw):
46
51
        z = time.time()
47
 
        h = util.get_history()
 
52
        h = self._branch.get_history()
48
53
        
49
54
        if len(args) > 0:
50
55
            revid = h.fix_revid(args[0])
53
58
        
54
59
        file_id = kw.get('file_id', None)
55
60
        if file_id is None:
56
 
            raise HTTPRedirect(turbogears.url('/changes'))
 
61
            raise HTTPRedirect(self._branch.url('/changes'))
57
62
 
58
63
        try:
59
64
            revid_list, revid = h.get_file_view(revid, file_id)
60
65
        except Exception, x:
61
 
            log.error('Exception fetching changes: %s' % (x,))
62
 
            util.log_exception(log)
63
 
            raise HTTPRedirect(turbogears.url('/changes'))
 
66
            self.log.error('Exception fetching changes: %s' % (x,))
 
67
            util.log_exception(self.log)
 
68
            raise HTTPRedirect(self._branch.url('/changes'))
64
69
            
65
70
        # no navbar for revisions
66
71
        navigation = util.Container()
69
74
        filename = os.path.basename(path)
70
75
 
71
76
        vals = {
72
 
            'branch_name': util.get_config().get('branch_name'),
 
77
            'branch': self._branch,
73
78
            'util': util,
74
79
            'revid': revid,
75
80
            'file_id': file_id,
81
86
            'contents': list(h.annotate_file(file_id, revid)),
82
87
        }
83
88
        h.flush_cache()
84
 
        log.info('/annotate: %r secs' % (time.time() - z,))
 
89
        self.log.info('/annotate: %r secs' % (time.time() - z,))
85
90
        return vals