=== modified file 'loggerhead/controllers/__init__.py' --- loggerhead/controllers/__init__.py 2008-09-30 02:04:14 +0000 +++ loggerhead/controllers/__init__.py 2008-10-25 18:13:27 +0000 @@ -63,8 +63,8 @@ class TemplatedBranchView(object): def __call__(self, environ, start_response): z = time.time() h = self._history - kw = dict(parse_querystring(environ)) - util.set_context(kw) + kwargs = dict(parse_querystring(environ)) + util.set_context(kwargs) args = [] while 1: arg = path_info_pop(environ) @@ -72,6 +72,17 @@ class TemplatedBranchView(object): break args.append(arg) + revid = None + if h is not None: + if len(args) > 0: + revid = h.fix_revid(args[0]) + else: + revid = h.last_revid + + path = None + if len(args) > 1: + path = '/'.join(args[1:]) + vals = { 'static_url': self._branch.static_url, 'branch': self._branch, @@ -81,7 +92,7 @@ class TemplatedBranchView(object): } vals.update(templatefunctions) headers = {} - vals.update(self.get_values(h, args, kw, headers)) + vals.update(self.get_values(h, revid, path, kwargs, headers)) self.log.info('Getting information for %s: %r secs' % ( self.__class__.__name__, time.time() - z,)) @@ -93,6 +104,7 @@ class TemplatedBranchView(object): w = BufferingWriter(writer, 8192) template.expand_into(w, **vals) w.flush() - self.log.info('Rendering %s: %r secs, %s bytes, %s (%2.1f%%) bytes saved' % ( - self.__class__.__name__, time.time() - z, w.bytes, w.bytes_saved, 100.0*w.bytes_saved/w.bytes)) + self.log.info('Rendering %s: %r secs, %s bytes, %s (%2.1f%%) bytes saved' % + (self.__class__.__name__, time.time() - z, w.bytes, w.bytes_saved, + 100.0*w.bytes_saved/w.bytes)) return [] === modified file 'loggerhead/controllers/annotate_ui.py' --- loggerhead/controllers/annotate_ui.py 2008-09-09 22:42:27 +0000 +++ loggerhead/controllers/annotate_ui.py 2008-10-25 18:13:27 +0000 @@ -36,19 +36,10 @@ class AnnotateUI (TemplatedBranchView): template_path = 'loggerhead.templates.annotate' - def get_values(self, h, args, kw, headers): - if len(args) > 0: - revid = h.fix_revid(args[0]) - else: - revid = h.last_revid - - path = None - if len(args) > 1: - path = '/'.join(args[1:]) - if not path.startswith('/'): - path = '/' + path + def get_values(self, h, revid, path, kwargs, headers): - file_id = kw.get('file_id', None) + revid = h.fix_revid(revid) + file_id = kwargs.get('file_id', None) if (file_id is None) and (path is None): raise HTTPBadRequest('No file_id or filename provided to annotate') === modified file 'loggerhead/controllers/atom_ui.py' --- loggerhead/controllers/atom_ui.py 2008-07-22 00:40:03 +0000 +++ loggerhead/controllers/atom_ui.py 2008-10-25 18:13:27 +0000 @@ -24,7 +24,7 @@ class AtomUI (TemplatedBranchView): template_path = 'loggerhead.templates.atom' - def get_values(self, h, args, kw, headers): + def get_values(self, h, revid, path, kwargs, headers): pagesize = int(20)#self._branch.config.get('pagesize', '20')) revid_list = h.get_file_view(h.last_revid, None) === modified file 'loggerhead/controllers/changelog_ui.py' --- loggerhead/controllers/changelog_ui.py 2008-08-16 21:53:52 +0000 +++ loggerhead/controllers/changelog_ui.py 2008-10-25 18:13:27 +0000 @@ -27,23 +27,22 @@ class ChangeLogUI(TemplatedBranchView): template_path = 'loggerhead.templates.changelog' - def get_values(self, h, args, kw, headers): - if args: - revid = h.fix_revid(args[0]) - else: - revid = None - - filter_file_id = kw.get('filter_file_id', None) - query = kw.get('q', None) - start_revid = h.fix_revid(kw.get('start_revid', None)) + def get_values(self, h, revid, path, kwargs, headers): + + filter_file_id = kwargs.get('filter_file_id', None) + query = kwargs.get('q', None) + start_revid = h.fix_revid(kwargs.get('start_revid', None)) orig_start_revid = start_revid pagesize = 20#int(config.get('pagesize', '20')) search_failed = False + if filter_file_id is None and path is not None: + filter_file_id = h.get_file_id(revid, path) + try: revid, start_revid, revid_list = h.get_view( revid, start_revid, filter_file_id, query) - util.set_context(kw) + util.set_context(kwargs) if (query is not None) and (len(revid_list) == 0): search_failed = True @@ -74,18 +73,6 @@ class ChangeLogUI(TemplatedBranchView): # add parent & merge-point branch-nick info, in case it's useful h.get_branch_nicks(changes) - # does every change on this page have the same committer? if so, - # tell the template to show committer info in the "details block" - # instead of on each line. - all_same_author = True - - if changes: - author = changes[0].author - for e in changes[1:]: - if e.author != author: - all_same_author = False - break - # Directory Breadcrumbs directory_breadcrumbs = ( util.directory_breadcrumbs( @@ -105,7 +92,6 @@ class ChangeLogUI(TemplatedBranchView): 'viewing_from': (orig_start_revid is not None) and (orig_start_revid != h.last_revid), 'query': query, 'search_failed': search_failed, - 'all_same_author': all_same_author, 'url': self._branch.context_url, 'directory_breadcrumbs': directory_breadcrumbs, } === modified file 'loggerhead/controllers/directory_ui.py' --- loggerhead/controllers/directory_ui.py 2008-09-30 02:57:08 +0000 +++ loggerhead/controllers/directory_ui.py 2008-10-25 18:13:27 +0000 @@ -57,7 +57,7 @@ class DirectoryUI(TemplatedBranchView): self._static_url_base = static_url_base self.log = logging.getLogger('') - def get_values(self, h, args, kwargs, response): + def get_values(self, h, revid, path, kwargs, response): listing = [d for d in os.listdir(self._path) if not d.startswith('.') and os.path.isdir(os.path.join(self._path, d))] === modified file 'loggerhead/controllers/inventory_ui.py' --- loggerhead/controllers/inventory_ui.py 2008-10-01 22:23:24 +0000 +++ loggerhead/controllers/inventory_ui.py 2008-10-25 18:13:27 +0000 @@ -1,4 +1,5 @@ # +# Copyright (C) 2008 Canonical Ltd. # Copyright (C) 2006 Robey Pointer