17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
from cherrypy import InternalError, session
23
from paste.httpexceptions import HTTPServerError
30
25
from loggerhead import util
26
from loggerhead.controllers import TemplatedBranchView
33
29
log = logging.getLogger("loggerhead.controllers")
38
34
path = posixpath.dirname(path)
42
class InventoryUI (object):
44
def __init__(self, branch):
49
@util.strip_whitespace
50
@turbogears.expose(html='loggerhead.templates.inventory')
51
def default(self, *args, **kw):
53
h = self._branch.get_history()
38
class InventoryUI(TemplatedBranchView):
40
template_path = 'loggerhead.templates.inventory'
42
def get_values(self, h, args, kw, headers):
44
revid = h.fix_revid(args[0])
59
revid = h.fix_revid(args[0])
64
inv = h.get_inventory(revid)
66
self.log.exception('Exception fetching changes')
67
raise InternalError('Could not fetch changes')
69
file_id = kw.get('file_id', inv.root.file_id)
70
sort_type = kw.get('sort', None)
72
# no navbar for revisions
73
navigation = util.Container()
75
change = h.get_changes([ revid ])[0]
76
# add parent & merge-point branch-nick info, in case it's useful
77
h.get_branch_nicks([ change ])
79
path = inv.id2path(file_id)
80
if not path.startswith('/'):
82
idpath = inv.get_idpath(file_id)
85
updir_file_id = idpath[-2]
93
'branch': self._branch,
100
'updir_file_id': updir_file_id,
101
'filelist': h.get_filelist(inv, file_id, sort_type),
103
'posixpath': posixpath,
104
'navigation': navigation,
107
self.log.info('/inventory %r: %r secs' % (revid, time.time() - z))
49
inv = h.get_inventory(revid)
51
self.log.exception('Exception fetching changes')
52
raise HTTPServerError('Could not fetch changes')
54
file_id = kw.get('file_id', inv.root.file_id)
55
start_revid = kw.get('start_revid', None)
56
sort_type = kw.get('sort', None)
58
# no navbar for revisions
59
navigation = util.Container()
61
change = h.get_changes([ revid ])[0]
62
# add parent & merge-point branch-nick info, in case it's useful
63
h.get_branch_nicks([ change ])
65
path = inv.id2path(file_id)
66
if not path.startswith('/'):
68
idpath = inv.get_idpath(file_id)
71
updir_file_id = idpath[-2]
79
'branch': self._branch,
86
'updir_file_id': updir_file_id,
87
'filelist': h.get_filelist(inv, file_id, sort_type),
89
'posixpath': posixpath,
90
'navigation': navigation,
91
'url': self._branch.context_url,
92
'start_revid': start_revid,
93
'fileview_active': True,