From cb1593d6a27cc11dd7aa27b3617bd010dedc3cb1 Mon Sep 17 00:00:00 2001 From: Jim Schaad Date: Mon, 4 Feb 2013 17:45:03 +0000 Subject: [PATCH] Modify atom change feed so that 1. It returns the last 14 days of changes rather than the last 20 2. Change the atom template so that it has correct time offsets rather than saying that PST and UTC are the same 3. Change the atom template so that it uses content rather than summary and return HTML content with line breaks as needed. - Legacy-Id: 5425 --- ietf/community/views.py | 7 +++++-- ietf/templates/community/public/atom.xml | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ietf/community/views.py b/ietf/community/views.py index 5c5243de7..f24c1d8c3 100644 --- a/ietf/community/views.py +++ b/ietf/community/views.py @@ -2,6 +2,7 @@ import csv import uuid import datetime import hashlib +from datetime import timedelta from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME @@ -137,7 +138,9 @@ def view_group_list(request, acronym): def _atom_view(request, clist, significant=False): documents = [i['pk'] for i in clist.get_documents().values('pk')] - notifications = DocEvent.objects.filter(doc__pk__in=documents)\ + startDate = datetime.datetime.now() - datetime.timedelta(days=14) + + notifications = DocEvent.objects.filter(doc__pk__in=documents, time__gte=startDate)\ .distinct()\ .order_by('-time', '-id') if significant: @@ -154,7 +157,7 @@ def _atom_view(request, clist, significant=False): return render_to_response('community/public/atom.xml', {'cl': clist, - 'entries': notifications[:20], + 'entries': notifications, 'title': title, 'subtitle': subtitle, 'id': feed_id.get_urn(), diff --git a/ietf/templates/community/public/atom.xml b/ietf/templates/community/public/atom.xml index 9ba08ab86..4a4ebe11d 100644 --- a/ietf/templates/community/public/atom.xml +++ b/ietf/templates/community/public/atom.xml @@ -3,7 +3,7 @@ {{ title }} {{ subtitle }} {{ id }} - {{ updated|date:"Y-m-d\TH:i:s" }}Z + {{ updated|date:"Y-m-d\TH:i:sO" }} @@ -15,16 +15,16 @@ {{ entry.id }} - {{ entry.time|date:"Y-m-d\TH:i:s" }}Z + {{ entry.time|date:"Y-m-d\TH:i:sO" }} - {{ entry.time|date:"Y-m-d\TH:i:s" }} + {{ entry.time|date:"Y-m-d\TH:i:sO" }} {{ entry.by }} - - {{ entry.desc|striptags }} - +{%autoescape off %} + {{ entry.desc|linebreaksbr|force_escape }} +{%endautoescape %} {% endfor %}