~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/atom_ui.py

  • Committer: Robey Pointer
  • Date: 2006-12-18 04:16:27 UTC
  • Revision ID: robey@lag.net-20061218041627-u7dyjoqpo6nygzut
remove tabs

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import turbogears
21
21
 
22
22
from loggerhead import util
23
 
from loggerhead.templatefunctions import templatefunctions
24
23
 
25
24
 
26
25
class AtomUI (object):
27
26
    
28
 
    def __init__(self, branch):
29
 
        # BranchView object
30
 
        self._branch = branch
31
 
        self.log = branch.log
32
 
 
33
 
    @turbogears.expose(template='zpt:loggerhead.templates.atom',
34
 
                       format="xml", content_type="application/atom+xml")
35
 
    def default(self, *args, **kwargs):
36
 
        h = self._branch.get_history()
37
 
 
38
 
        h._branch.lock_read()
39
 
        try:
40
 
            pagesize = int(self._branch.config.get('pagesize', '20'))
41
 
 
42
 
            revid_list = h.get_file_view(h.last_revid, None)
43
 
            entries = list(h.get_changes(list(revid_list)[:pagesize]))
44
 
 
45
 
            vals = {
46
 
                'branch': self._branch,
47
 
                'changes': entries,
48
 
                'util': util,
49
 
                'history': h,
50
 
                'updated': entries[0].date.isoformat() + 'Z',
51
 
            }
52
 
            vals.update(templatefunctions)
53
 
            h.flush_cache()
54
 
            return vals
55
 
        finally:
56
 
            h._branch.unlock()
 
27
    @turbogears.expose(template='loggerhead.templates.atom', format="xml", content_type="application/atom+xml")
 
28
    def default(self, *args):
 
29
        h = util.get_history()
 
30
        pagesize = int(util.get_config().get('pagesize', '20'))
 
31
 
 
32
        revlist, start_revid = h.get_navigation(None, None)
 
33
        entries = list(h.get_changelist(list(revlist)[:pagesize]))
 
34
 
 
35
        vals = {
 
36
            'external_url': util.get_config().get('external_url'),
 
37
            'branch_name': util.get_config().get('branch_name'),
 
38
            'changes': entries,
 
39
            'util': util,
 
40
            'history': h,
 
41
            'scan_url': '/changes',
 
42
            'updated': entries[0].date.isoformat() + 'Z',
 
43
        }
 
44
        h.flush_cache()
 
45
        return vals