Skip to content

Commit

Permalink
Add a per-year RFC feed. Commit ready for merge.
Browse files Browse the repository at this point in the history
 - Legacy-Id: 14386
  • Loading branch information
rjsparks committed Dec 1, 2017
1 parent 16ab423 commit 6ab819b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions ietf/doc/feeds.py
Expand Up @@ -110,10 +110,16 @@ class RfcFeed(Feed):
title = "RFCs"
author_name = "RFC Editor"
link = "https://www.rfc-editor.org/rfc-index2.html"

def get_object(self,request,year=None):
self.year = year

def items(self):
cutoff = datetime.datetime.now() - datetime.timedelta(days=8)
rfc_events = DocEvent.objects.filter(type='published_rfc',time__gte=cutoff).order_by('-time')
if self.year:
rfc_events = DocEvent.objects.filter(type='published_rfc',time__year=self.year).order_by('-time')
else:
cutoff = datetime.datetime.now() - datetime.timedelta(days=8)
rfc_events = DocEvent.objects.filter(type='published_rfc',time__gte=cutoff).order_by('-time')
results = [(e.doc, e.time) for e in rfc_events]
for doc,time in results:
doc.publication_time = time
Expand Down
2 changes: 2 additions & 0 deletions ietf/doc/tests.py
Expand Up @@ -802,6 +802,8 @@ def test_rfc_feed(self):
make_test_data()
r = self.client.get("/feed/rfc/")
self.assertTrue(r.status_code, 200)
r = self.client.get("/feed/rfc/2016")
self.assertTrue(r.status_code, 200)

def test_state_help(self):
url = urlreverse('ietf.doc.views_help.state_help', kwargs=dict(type="draft-iesg"))
Expand Down
3 changes: 2 additions & 1 deletion ietf/feed_urls.py
Expand Up @@ -18,5 +18,6 @@
url(r'^ipr/$', LatestIprDisclosuresFeed()),
url(r'^liaison/(?P<kind>recent|from|to|subject)/(?:(?P<search>[^/]+)/)?$', LiaisonStatementsFeed()),
url(r'^wg-proceedings/$', LatestMeetingMaterialFeed()),
url(r'^rfc/$', RfcFeed())
url(r'^rfc/$', RfcFeed()),
url(r'^rfc/(?P<year>\d{4})/$', RfcFeed()),
]

0 comments on commit 6ab819b

Please sign in to comment.