Tue Dec 13 14:12:44 UTC 2005 Alberto Bertogli * Small changes to do_atom(), make it validate. diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi --- old-darcsweb/darcsweb.cgi 2015-09-24 16:54:20.000000000 +0000 +++ new-darcsweb/darcsweb.cgi 2015-09-24 16:54:21.000000000 +0000 @@ -19,6 +19,7 @@ import urllib import xml.sax from xml.sax.saxutils import escape as xml_escape +import email.Utils iso_datetime = '%Y-%m-%dT%H:%M:%SZ' @@ -233,6 +234,8 @@ + @@ -1721,10 +1724,14 @@ print '' inv = config.repodir + '/_darcs/inventory' repo_lastmod = os.stat(inv).st_mtime - print """ + str_lastmod = time.strftime(iso_datetime, + time.localtime(repo_lastmod)) + + print """ + %(reponame)s darcs repository - + %(url)s darcs repository (several authors) darcsweb.cgi @@ -1734,7 +1741,9 @@ 'reponame': config.reponame, 'url': config.myurl + '/' + config.myreponame, 'desc': config.repodesc, - 'lastmod': time.strftime(iso_datetime, time.localtime(repo_lastmod))} + 'lastmod': str_lastmod, + } + ps = get_last_patches(20) for p in ps: title = time.strftime('%d %b %H:%M', time.localtime(p.date)) @@ -1744,25 +1753,38 @@ link = '%s/%s;a=commit;h=%s' % (config.myurl, config.myreponame, p.hash) + addr, author = email.Utils.parseaddr(p.author) + if not addr: + addr = "unknown_email@example.com" + if not author: + author = addr + print """ %(title)s - %(author)s + + %(author)s + %(email)s + %(pdate)s - %(url)s/%(pname)s + %(link)s %(desc)s +

""" % { 'title': escape(title), - 'author': p.author, + 'author': author, + 'email': addr, 'url': config.myurl + '/' + config.myreponame, 'pdate': pdate, + 'myrname': config.myreponame, + 'hash': p.hash, 'pname': escape(p.name), 'link': link, 'desc': escape(p.name), } + # TODO: allow to get plain text, not HTML? - print '

' print escape(p.name) + '
' if p.comment: print '
' @@ -1777,7 +1799,7 @@ print '

' print '' print '' - + def do_rss(): print "Content-type: text/xml; charset=utf-8\n" print ''