X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=inline;f=tools%2Fqueue_rss.py;h=0e47d57b01f0987b042f5ee66dd5e1418d75e8fe;hb=93b984f622111a219b0db0bee2ab7292ac0db654;hp=8eb81f17da99df7b755e3e7209531c99293a3936;hpb=05c4968c640f85551908ba3ef0bf8c9cecfea463;p=dak.git diff --git a/tools/queue_rss.py b/tools/queue_rss.py index 8eb81f17..0e47d57b 100755 --- a/tools/queue_rss.py +++ b/tools/queue_rss.py @@ -12,13 +12,17 @@ import cPickle import re import sys import time -import encodings.ascii from optparse import OptionParser from datetime import datetime import PyRSS2Gen -from debian_bundle.deb822 import Changes +try: + # starting with squeeze + from debian.deb822 import Changes +except: + # up to lenny + from debian_bundle.deb822 import Changes inrss_filename = "NEW_in.rss" outrss_filename = "NEW_out.rss" @@ -53,14 +57,6 @@ class Status: self.queue = {} -def utf2ascii(src): - """ Return an ASCII encoded copy of the input UTF-8 string """ - try: - res = unicode(src, 'utf-8').encode('ascii', 'replace') - except UnicodeDecodeError: - res = None - return res - def purge_old_items(feed, max): """ Purge RSSItem from feed, no more than max. """ if feed.items is None or len(feed.items) == 0: @@ -144,8 +140,8 @@ def add_rss_item(status, msg, direction): return False description = "
Description: %s\nChanges: %s\n" % \ - (utf2ascii(cgi.escape(msg['Description'])), - utf2ascii(cgi.escape(msg['Changes']))) + (cgi.escape(msg['Description']), + cgi.escape(msg['Changes'])) link = "http://ftp-master.debian.org/new/%s_%s.html" % \ (msg['Source'], msg['Version']) @@ -155,7 +151,7 @@ def add_rss_item(status, msg, direction): title, pubDate = pubdate, description = description, - author = utf2ascii(cgi.escape(msg['Maintainer'])), + author = cgi.escape(msg['Maintainer']), link = link, guid = link )