~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/inventory_ui.py

make history.get_file_view have a clearer interface

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import time
26
26
 
27
27
import turbogears
28
 
from cherrypy import HTTPRedirect, session
 
28
from cherrypy import InternalError, session
29
29
 
30
30
from loggerhead import util
31
31
 
56
56
        if len(args) > 0:
57
57
            revid = h.fix_revid(args[0])
58
58
        else:
59
 
            revid = None
 
59
            revid = h.last_revid
60
60
        
61
 
        file_id = kw.get('file_id', None)
 
61
        try:
 
62
            rev = h.get_revision(revid)
 
63
            inv = h.get_inventory(revid)
 
64
        except:
 
65
            self.log.exception('Exception fetching changes')
 
66
            raise InternalError('Could not fetch changes')
 
67
 
 
68
        file_id = kw.get('file_id', inv.root.file_id)
62
69
        sort_type = kw.get('sort', None)
63
70
 
64
71
        try:
65
 
            revid_list, revid = h.get_file_view(revid, file_id)
66
72
            rev = h.get_revision(revid)
67
73
            inv = h.get_inventory(revid)
68
 
        except Exception, x:
69
 
            self.log.error('Exception fetching changes: %s' % (x,))
70
 
            util.log_exception(self.log)
71
 
            raise HTTPRedirect(self._branch.url('/changes'))
 
74
        except:
 
75
            self.log.exception('Exception fetching changes')
 
76
            raise InternalError('Could not fetch changes')
72
77
 
73
78
        # no navbar for revisions
74
79
        navigation = util.Container()
99
104
            'path': path,
100
105
            'updir': updir,
101
106
            'updir_file_id': updir_file_id,
102
 
            'filelist': h.get_filelist(inv, path, sort_type),
 
107
            'filelist': h.get_filelist(inv, file_id, sort_type),
103
108
            'history': h,
104
109
            'posixpath': posixpath,
105
110
            'navigation': navigation,