From: davyd Date: Thu, 12 Feb 2004 04:27:59 +0000 (+0000) Subject: Added feeds, caching tweaks and sorting feedlist alphabetically X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=7ed1e1e5186df89118c69fb7d28fbc0b5b365c96;p=planet-ucc.git Added feeds, caching tweaks and sorting feedlist alphabetically --- diff --git a/CacheHandler.py b/CacheHandler.py index cc5c87b..3463d71 100644 --- a/CacheHandler.py +++ b/CacheHandler.py @@ -18,7 +18,8 @@ class CacheHandler: try: cPickle.dump(blog, open(os.path.join('cache', name), 'w')) except: - sys.stderr.write('DEBUG: CacheHandler: Item could not be written to cache\n') +# sys.stderr.write('DEBUG: CacheHandler: Item could not be written to cache\n') + pass def getBlog(self, title, feed): name = self.__create_name__(title, feed) @@ -27,7 +28,7 @@ class CacheHandler: blog = cPickle.load(open(os.path.join('cache', name))) except: blog = None - sys.stderr.write('DEBUG: CacheHandler: Could not read item from cache\n') +# sys.stderr.write('DEBUG: CacheHandler: Could not read item from cache\n') return blog class CacheObject: diff --git a/XMLParse2.py b/XMLParse2.py index e338580..8f6dc7e 100644 --- a/XMLParse2.py +++ b/XMLParse2.py @@ -45,7 +45,6 @@ class XMLParse: sys.stdout.write('done.\n') except: sys.stdout.write('failed.\n') - raise return None # check to see what we got returned if data['items'] == [] and data['channel'] == {}: diff --git a/XMLWriter.py b/XMLWriter.py index 4f13913..38904dc 100644 --- a/XMLWriter.py +++ b/XMLWriter.py @@ -134,7 +134,9 @@ class XHTMLWriter: if self.parent: output += '

Feeds

\n' output += '

\n' - for blog in self.parent.blogs: + blogscopy = self.parent.blogs + [] + blogscopy.sort(self.__blog_sort__) + for blog in blogscopy: output += '%s (feed)
\n' % (blog.blogURL, blog.blogTitle, blog.feedURL) output += '

\n' output += '\n' @@ -160,3 +162,9 @@ class XHTMLWriter: output += '\n' output += '' return output + + def __blog_sort__(self, blog1, blog2): + name1, name2 = blog1.blogTitle.split(' ')[-1], blog2.blogTitle.split(' ')[-1] + if name1 < name2: return -1 + if name1 == name2: return 0 + if name1 > name2: return 1 diff --git a/feedlist b/feedlist index 584a545..01f74ed 100644 --- a/feedlist +++ b/feedlist @@ -3,17 +3,21 @@ # read in by update-planet, to generate planet.html # name url # -Davyd Madeley http://www.livejournal.com/users/davyd/data/rss -Ian McKellar http://ian.mckellar.org/wp-rss2.php -Grahame Bowland http://www.livejournal.com/users/grahame/data/rss -Adam Wright http://www.livejournal.com/users/hipikat/data/rss -Adrian Chadd http://blog.cacheboy.net/blogs/cacheboy/index.rdf -Trent Lloyd http://www.livejournal.com/users/lathiat/data/rss -Matt Johnson http://www.livejournal.com/users/mkj/data/rss -David Basden http://www.livejournal.com/users/shigawire/data/rss -Michael Deegan http://www.livejournal.com/users/leahcim/data/rss -James Cox http://www.livejournal.com/users/coxymla/data/rss -Mark Tearle http://www.livejournal.com/users/unfoldedreality/data/rss -Tom Castiglione http://www.livejournal.com/users/zharradan/data/rss -Elaine Walker http://ariaflame.blogspot.com/atom.xml -Rod Swift http://www.livejournal.com/users/rodcub/data/rss +Davyd Madeley http://www.livejournal.com/users/davyd/data/rss +Ian McKellar http://ian.mckellar.org/wp-rss2.php +Grahame Bowland http://www.livejournal.com/users/grahame/data/rss +Adam Wright http://www.livejournal.com/users/hipikat/data/rss +Adrian Chadd http://blog.cacheboy.net/blogs/cacheboy/index.rdf +Trent Lloyd http://www.livejournal.com/users/lathiat/data/rss +Matt Johnson http://www.livejournal.com/users/mkj/data/rss +David Basden http://www.livejournal.com/users/shigawire/data/rss +Michael Deegan http://www.livejournal.com/users/leahcim/data/rss +James Cox http://www.livejournal.com/users/coxymla/data/rss +Mark Tearle http://www.livejournal.com/users/unfoldedreality/data/rss +Tom Castiglione http://www.livejournal.com/users/zharradan/data/rss +Elaine Walker http://ariaflame.blogspot.com/atom.xml +Chris Bobridge http://www.livejournal.com/users/maelkann/data/rss +Aaron Alderman http://www.livejournal.com/users/palaceboy/data/rss +Brad Wake http://www.livejournal.com/users/thebmw/data/rss +Mikolaj Habryn http://mikolaj.tv/rss2.xml +James Andrewartha http://www.advogato.com/person/trs80/rss.xml