~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-16 01:43:52 UTC
  • Revision ID: robey@lag.net-20061216014352-euf7pthd6ik80p6n
some suggestions from bazaar-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
#
19
19
 
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
 
        pagesize = int(20)#self._branch.config.get('pagesize', '20'))
30
 
 
31
 
        revid_list = history.get_file_view(history.last_revid, None)
32
 
        entries = list(history.get_changes(list(revid_list)[:pagesize]))
33
 
 
34
 
        headers['Content-Type'] = 'application/atom+xml'
35
 
        return {
 
20
import turbogears
 
21
 
 
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 = util.get_history()
 
30
 
 
31
        # really, there is no point giving a revid here...
 
32
        if len(args) > 0:
 
33
            revid = args[0]
 
34
        else:
 
35
            revid = h.last_revid
 
36
        revlist = h.get_short_revision_history_from(revid)
 
37
        entries = list(h.get_changelist(list(revlist)[:20]))
 
38
 
 
39
        vals = {
 
40
            'external_url': util.get_config().get('external_url'),
 
41
            'branch_name': util.get_config().get('branch_name'),
36
42
            'changes': entries,
37
 
            'updated': entries[0].utc_date.isoformat(),
38
 
            'history': self._history,
 
43
            'util': util,
 
44
            'history': h,
 
45
            'scan_url': '/changes',
 
46
            'updated': entries[0].date.isoformat() + 'Z',
39
47
        }
 
48
        h.flush_cache()
 
49
        return vals