28
from cherrypy import HTTPError, InternalError, session
28
from cherrypy import HTTPRedirect, session
30
30
from loggerhead import util
46
46
self._branch = branch
47
47
self.log = branch.log
49
@util.strip_whitespace
50
49
@turbogears.expose(html='loggerhead.templates.annotate')
51
50
def default(self, *args, **kw):
53
52
h = self._branch.get_history()
57
55
revid = h.fix_revid(args[0])
62
path = '/'.join(args[1:])
63
if not path.startswith('/'):
66
59
file_id = kw.get('file_id', None)
67
if (file_id is None) and (path is None):
68
raise HTTPError(400, 'No file_id or filename provided to annotate')
70
60
if file_id is None:
71
file_id = h.get_file_id(revid, path)
61
raise HTTPRedirect(self._branch.url('/changes'))
74
64
revid_list, revid = h.get_file_view(revid, file_id)
76
self.log.exception('Exception fetching changes')
77
raise InternalError('Could not fetch changes')
66
self.log.error('Exception fetching changes: %s' % (x,))
67
util.log_exception(self.log)
68
raise HTTPRedirect(self._branch.url('/changes'))
79
70
# no navbar for revisions
80
71
navigation = util.Container()
83
path = h.get_path(revid, file_id)
73
path = h.get_path(revid, file_id)
84
74
filename = os.path.basename(path)