~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/atom_ui.py

  • Committer: Michael Hudson
  • Date: 2009-04-01 14:40:05 UTC
  • Revision ID: michael.hudson@canonical.com-20090401144005-trxdnfy5hd5wrd39
a quick dose of IE compatibility:
* ''.splice behaves differently
* io-queue doesn't seem to work, but isn't useful for me anyway...

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
2
# Copyright (C) 2006  Robey Pointer <robey@lag.net>
 
3
# Copyright (C) 2006  Goffredo Baroncelli <kreijack@inwind.it>
3
4
#
4
5
# This program is free software; you can redistribute it and/or modify
5
6
# it under the terms of the GNU General Public License as published by
16
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18
#
18
19
 
19
 
import turbogears
20
 
 
21
 
from loggerhead.history import History
22
 
from loggerhead import util
23
 
 
24
 
 
25
 
class AtomUI (object):
26
 
 
27
 
    @turbogears.expose(template='loggerhead.templates.atom', format="xml", content_type="application/atom+xml")
28
 
    def default(self, *args):
29
 
        h = History.from_folder(turbogears.config.get('loggerhead.folder'))
30
 
        if len(args) > 0:
31
 
            revid = args[0]
32
 
        else:
33
 
            revid = h.last_revid
34
 
        revlist = h.get_short_revision_history_from(revid)
35
 
        entries = list(h.get_changelist(list(revlist)[:20]))
36
 
 
37
 
        vals = {
38
 
            'external_url': turbogears.config.get('loggerhead.external_url'),
39
 
            'branch_name': turboears.config.get('loggerhead.branch_name'),
 
20
from loggerhead.controllers import TemplatedBranchView
 
21
 
 
22
 
 
23
class AtomUI (TemplatedBranchView):
 
24
 
 
25
    template_path = 'loggerhead.templates.atom'
 
26
 
 
27
    def get_values(self, path, kwargs, headers):
 
28
        history = self._history
 
29
        revid = self.get_revid()
 
30
        pagesize = int(20)#self._branch.config.get('pagesize', '20'))
 
31
 
 
32
        revid_list = history.get_file_view(history.last_revid, None)
 
33
        entries = list(history.get_changes(list(revid_list)[:pagesize]))
 
34
 
 
35
        headers['Content-Type'] = 'application/atom+xml'
 
36
        return {
40
37
            'changes': entries,
41
 
            'util': util,
42
 
            'history': h,
43
 
            'scan_url': '/changes',
44
38
            'updated': entries[0].date.isoformat() + 'Z',
 
39
            'history': self._history,
45
40
        }
46
 
        return vals