Mercurial > p > roundup > code
diff website/issues/detectors/rsswriter.py @ 6465:bed1313898d4
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.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Fri, 06 Aug 2021 01:20:45 -0400 |
| parents | 0014af559224 |
| children |
line wrap: on
line diff
--- a/website/issues/detectors/rsswriter.py Tue Aug 03 17:35:20 2021 -0400 +++ b/website/issues/detectors/rsswriter.py Fri Aug 06 01:20:45 2021 -0400 @@ -63,7 +63,7 @@ # The strftime format to use for <pubDate>s. -RSS20_DATE_FORMAT = '%a, %d %b %Y %H:%M:%S %z' +RSS20_DATE_FORMAT = '%a, %d %b %Y %H:%M:%S +0000' def newRss(title, link, description): @@ -74,6 +74,7 @@ root = rss.appendChild(rss.createElement("rss")) root.setAttribute("version", "2.0") root.setAttribute("xmlns:atom","http://www.w3.org/2005/Atom") + root.setAttribute("xmlns:dc","http://purl.org/dc/elements/1.1/") channel = root.appendChild(rss.createElement("channel")) addEl = lambda tag,value: channel.appendChild(rss.createElement(tag)).appendChild(rss.createTextNode(value)) @@ -175,7 +176,10 @@ addEl(item, 'comments', issuelink) addEl(item, 'description', desc.replace('&','&').replace('<','<').replace('\n', '<br>\n')) addEl(item, 'pubDate', date) - addEl(item, 'author', + # use dc:creator as username is not valid email address and + # author element must be valid email address + # addEl(item, 'author', + addEl(item, 'dc:creator', '%s' % ( db.user.get(userid, 'username') )
