~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/revision_ui.py

  • Committer: Michael Hudson
  • Date: 2007-07-04 12:14:56 UTC
  • mfrom: (128.1.41 testing)
  • Revision ID: michael.hudson@canonical.com-20070704121456-5e5fz9ov5ofmdj6t
two brown paper bag fixes FROM THE RIGHT PLACE

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import time
25
25
 
26
26
import turbogears
27
 
from cherrypy import HTTPRedirect, session
 
27
from cherrypy import InternalError, session
28
28
 
29
29
from loggerhead import util
30
30
 
35
35
        # BranchView object
36
36
        self._branch = branch
37
37
        self.log = branch.log
38
 
 
 
38
    
 
39
#    @util.lsprof
 
40
    @util.strip_whitespace
39
41
    @turbogears.expose(html='loggerhead.templates.revision')
40
42
    def default(self, *args, **kw):
41
43
        z = time.time()
42
44
        h = self._branch.get_history()
 
45
        util.set_context(kw)
43
46
        
44
47
        if len(args) > 0:
45
48
            revid = h.fix_revid(args[0])
49
52
        file_id = kw.get('file_id', None)
50
53
        start_revid = h.fix_revid(kw.get('start_revid', None))
51
54
        query = kw.get('q', None)
 
55
        remember = kw.get('remember', None)
 
56
        compare_revid = kw.get('compare_revid', None)
52
57
        
53
58
        try:
54
59
            revid, start_revid, revid_list = h.get_view(revid, start_revid, file_id, query)
55
 
        except Exception, x:
56
 
            self.log.error('Exception fetching changes: %s' % (x,))
57
 
            util.log_exception(self.log)
58
 
            raise HTTPRedirect(self._branch.url('/changes'))
 
60
        except:
 
61
            self.log.exception('Exception fetching changes')
 
62
            raise InternalError('Could not fetch changes')
59
63
        
60
64
        navigation = util.Container(revid_list=revid_list, revid=revid, start_revid=start_revid, file_id=file_id,
61
65
                                    pagesize=1, scan_url='/revision', branch=self._branch, feed=True)
62
66
        if query is not None:
63
67
            navigation.query = query
64
 
        util.fill_in_navigation(h, navigation)
 
68
        util.fill_in_navigation(navigation)
65
69
 
66
 
        change = h.get_changes([ revid ], get_diffs=True)[0]
 
70
        if compare_revid is not None:
 
71
            change = h.get_diff(compare_revid, revid)
 
72
        else:
 
73
            change = h.get_changes([ revid ], get_diffs=True)[0]
67
74
        # add parent & merge-point branch-nick info, in case it's useful
68
75
        h.get_branch_nicks([ change ])
69
76
 
82
89
            'history': h,
83
90
            'navigation': navigation,
84
91
            'query': query,
 
92
            'remember': remember,
 
93
            'compare_revid': compare_revid,
85
94
            'side_by_side': side_by_side,
86
95
        }
87
96
        h.flush_cache()