Skip to content

Commit f8d046e

Browse files
committed
Force time format to include offset, use dc:creator not author
publish times were missing timezone even though %z was in the format string. Since time is GMT, hardcoded +0000. Author element is required to be a real address. Use dublin core creator instead (dc;creator). Had to add namespace xmlns:dc to root element.
1 parent 8efc6f2 commit f8d046e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

website/issues/detectors/rsswriter.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464

6565
# The strftime format to use for <pubDate>s.
66-
RSS20_DATE_FORMAT = '%a, %d %b %Y %H:%M:%S %z'
66+
RSS20_DATE_FORMAT = '%a, %d %b %Y %H:%M:%S +0000'
6767

6868

6969
def newRss(title, link, description):
@@ -74,6 +74,7 @@ def newRss(title, link, description):
7474
root = rss.appendChild(rss.createElement("rss"))
7575
root.setAttribute("version", "2.0")
7676
root.setAttribute("xmlns:atom","http://www.w3.org/2005/Atom")
77+
root.setAttribute("xmlns:dc","http://purl.org/dc/elements/1.1/")
7778

7879
channel = root.appendChild(rss.createElement("channel"))
7980
addEl = lambda tag,value: channel.appendChild(rss.createElement(tag)).appendChild(rss.createTextNode(value))
@@ -175,7 +176,10 @@ def addItem(desc, date, userid):
175176
addEl(item, 'comments', issuelink)
176177
addEl(item, 'description', desc.replace('&','&amp;').replace('<','&lt;').replace('\n', '<br>\n'))
177178
addEl(item, 'pubDate', date)
178-
addEl(item, 'author',
179+
# use dc:creator as username is not valid email address and
180+
# author element must be valid email address
181+
# addEl(item, 'author',
182+
addEl(item, 'dc:creator',
179183
'%s' % (
180184
db.user.get(userid, 'username')
181185
)

0 commit comments

Comments
 (0)