~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/changelog_ui.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2008-03-04 06:16:12 UTC
  • mfrom: (147.1.2 release-final-prep)
  • Revision ID: launchpad@pqm.canonical.com-20080304061612-1q6l3vo604dkk8vg
[r=jamesh] final adjustments to the README and NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from cherrypy import InternalError
24
24
 
25
25
from loggerhead import util
26
 
from loggerhead.templatefunctions import templatefunctions
27
26
 
28
27
 
29
28
class ChangeLogUI (object):
34
33
        self.log = branch.log
35
34
        
36
35
    @util.strip_whitespace
37
 
    @turbogears.expose(html='zpt:loggerhead.templates.changelog')
 
36
    @turbogears.expose(html='loggerhead.templates.changelog')
38
37
    def default(self, *args, **kw):
39
38
        z = time.time()
40
39
        h = self._branch.get_history()
47
46
            else:
48
47
                revid = None
49
48
 
50
 
            filter_file_id = kw.get('filter_file_id', None)
 
49
            file_id = kw.get('file_id', None)
51
50
            query = kw.get('q', None)
52
51
            start_revid = h.fix_revid(kw.get('start_revid', None))
53
52
            orig_start_revid = start_revid
55
54
            search_failed = False
56
55
 
57
56
            try:
58
 
                revid, start_revid, revid_list = h.get_view(
59
 
                    revid, start_revid, filter_file_id, query)
 
57
                revid, start_revid, revid_list = h.get_view(revid, start_revid, file_id, query)
60
58
                kw['start_revid'] = start_revid
61
59
                util.set_context(kw)
62
60
 
78
76
                self.log.exception('Exception fetching changes')
79
77
                raise InternalError('Could not fetch changes')
80
78
 
81
 
            navigation = util.Container(
82
 
                pagesize=pagesize, revid=revid, start_revid=start_revid,
83
 
                revid_list=revid_list, filter_file_id=filter_file_id,
84
 
                scan_url='/changes', branch=self._branch, feed=True)
 
79
            navigation = util.Container(pagesize=pagesize, revid=revid, start_revid=start_revid, revid_list=revid_list,
 
80
                                        file_id=file_id, scan_url='/changes', branch=self._branch, feed=True)
85
81
            if query is not None:
86
82
                navigation.query = query
87
83
            util.fill_in_navigation(navigation)
101
97
                        all_same_author = False
102
98
                        break
103
99
 
104
 
            def url(pathargs, **kw):
105
 
                return self._branch.url(pathargs, **util.get_context(**kw))
106
 
 
107
100
            vals = {
108
101
                'branch': self._branch,
109
102
                'changes': changes,
111
104
                'history': h,
112
105
                'revid': revid,
113
106
                'navigation': navigation,
114
 
                'filter_file_id': filter_file_id,
 
107
                'file_id': file_id,
115
108
                'start_revid': start_revid,
116
109
                'viewing_from': (orig_start_revid is not None) and (orig_start_revid != h.last_revid),
117
110
                'query': query,
118
111
                'search_failed': search_failed,
119
112
                'all_same_author': all_same_author,
120
 
                'url': url,
121
113
            }
122
 
            vals.update(templatefunctions)
123
114
            h.flush_cache()
124
115
            self.log.info('/changes %r: %r secs' % (revid, time.time() - z))
125
116
            return vals