[yum-commits] repo-rss.py

James Antill james at osuosl.org
Tue Aug 13 14:14:05 UTC 2013


 repo-rss.py |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 9254c90bac77f4627f30eb51f0713a655ee2a335
Author: Morty <morty at frakir.org>
Date:   Tue Aug 13 09:49:36 2013 -0400

     repo-rss: non-ASCII fix, sorting
    
    1. fixes a bug where repo-rss crashed when dealing with packages that
       contain non-ASCII in their descriptions.
    
    2. reverse sorts the results by filetime so the most recent package
       builds will be first in the RSS feed.

diff --git a/repo-rss.py b/repo-rss.py
index f14ff2a..871e338 100755
--- a/repo-rss.py
+++ b/repo-rss.py
@@ -144,7 +144,7 @@ class RepoRSS:
             changelog += '%s - %s\n%s\n\n' % (date, author, desc)
         description = '<p><strong>%s</strong> - %s</p>\n\n' % (escape(pkg.name), 
                                             escape(pkg.returnSimple('summary')))
-        description += '<p>%s</p>\n\n<p><strong>Change Log:</strong></p>\n\n' % escape(pkg.returnSimple('description').encode('utf-8').replace("\n", "<br />\n"))
+        description += '<p>%s</p>\n\n<p><strong>Change Log:</strong></p>\n\n' % escape(to_unicode(pkg.returnSimple('description')).encode('utf-8').replace("\n", "<br />\n"))
         description += escape('<pre>%s</pre>' % escape(to_unicode(changelog).encode('utf-8')))
         item.newChild(None, 'description', description)
         
@@ -222,6 +222,8 @@ def main(options, args):
             sys.exit(1)
     
     recent = my.getRecent(days=days)
+    recent.sort(key=lambda pkg: pkg.returnSimple('filetime'))
+    recent.reverse()
     if options.groups:
         comps = Comps()
         for repo in my.repos.listEnabled():


More information about the Yum-commits mailing list