3
3
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
5
5
# Validated through http://validator.w3.org/feed/
6
8
class RssHistoryFeed(Feed):
8
10
feed_type = Rss201rev2Feed
11
13
link = '/wiki/feeds/rss/'
12
14
title_template = 'wiki/feeds/history_title.html'
13
15
description_template = 'wiki/feeds/history_description.html'
16
18
return ChangeSet.objects.order_by('-modified')[:30]
18
20
def item_pubdate(self, item):
20
Return the item's pubdate. It's this modified date
21
"""Return the item's pubdate.
23
It's this modified date
22
26
return item.modified
24
28
def item_author_name(self, item):
26
Takes the object returned by items(), and returns the feeds's
27
auhor's name as a Python string
29
"""Takes the object returned by items(), and returns the feeds's
30
auhor's name as a Python string."""
29
31
if item.is_anonymous_change():
31
33
return item.editor.username
33
35
# Validated through http://validator.w3.org/feed/
34
38
class AtomHistoryFeed(RssHistoryFeed):
36
40
feed_type = Atom1Feed
40
44
def item_updateddate(self, item):
41
45
return item.modified
43
47
# Validated through http://validator.w3.org/feed/
44
50
class RssArticleHistoryFeed(Feed):
45
51
feed_type = Rss201rev2Feed
46
52
title_template = u'wiki/feeds/history_title.html'
58
64
return item.get_absolute_url()
60
66
def description(self, item):
61
return "Recent changes in %s" % item.title
67
return 'Recent changes in %s' % item.title
63
69
def items(self, item):
64
70
return ChangeSet.objects.filter(article__id__exact=item.id).order_by('-modified')[:30]
66
72
def item_pubdate(self, item):
68
Returns the modified date
73
"""Returns the modified date."""
70
74
return item.modified
72
76
# Validated through http://validator.w3.org/feed/
73
79
class AtomArticleHistoryFeed(RssArticleHistoryFeed):
74
80
feed_type = Atom1Feed
76
82
def subtitle(self, item):
77
return "Recent changes in %s" % item.title
83
return 'Recent changes in %s' % item.title
79
85
def item_updateddate(self, item):
80
86
return item.modified
82
88
def item_author_name(self, item):
84
Takes the object returned by items(), and returns the feeds's
85
auhor's name as a Python string
89
"""Takes the object returned by items(), and returns the feeds's
90
auhor's name as a Python string."""
87
91
if item.is_anonymous_change():
89
return item.editor.username
b'\\ No newline at end of file'
93
return item.editor.username