/loggerhead/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerhead/trunk

« back to all changes in this revision

Viewing changes to loggerhead/controllers/atom_ui.py

merge performance improvements from mwh.dev, fixing silly conflicts along the way

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    @turbogears.expose(template='loggerhead.templates.atom', format="xml", content_type="application/atom+xml")
34
34
    def default(self, *args):
35
35
        h = self._branch.get_history()
36
 
        pagesize = int(self._branch.config.get('pagesize', '20'))
37
 
 
38
 
        revid_list = h.get_file_view(h.last_revid, None)
39
 
        entries = list(h.get_changes(list(revid_list)[:pagesize]))
40
 
 
41
 
        vals = {
42
 
            'branch': self._branch,
43
 
            'changes': entries,
44
 
            'util': util,
45
 
            'history': h,
46
 
            'updated': entries[0].date.isoformat() + 'Z',
47
 
        }
48
 
        h.flush_cache()
49
 
        return vals
 
36
 
 
37
        h._branch.lock_read()
 
38
        try:
 
39
            pagesize = int(self._branch.config.get('pagesize', '20'))
 
40
 
 
41
            revid_list = h.get_file_view(h.last_revid, None)
 
42
            entries = list(h.get_changes(list(revid_list)[:pagesize]))
 
43
 
 
44
            vals = {
 
45
                'branch': self._branch,
 
46
                'changes': entries,
 
47
                'util': util,
 
48
                'history': h,
 
49
                'updated': entries[0].date.isoformat() + 'Z',
 
50
            }
 
51
            h.flush_cache()
 
52
            return vals
 
53
        finally:
 
54
            h.unlock()