Added feeds, caching tweaks and sorting feedlist alphabetically
authordavyd <davyd>
Thu, 12 Feb 2004 04:27:59 +0000 (04:27 +0000)
committerdavyd <davyd>
Thu, 12 Feb 2004 04:27:59 +0000 (04:27 +0000)
CacheHandler.py
XMLParse2.py
XMLWriter.py
feedlist

index cc5c87b..3463d71 100644 (file)
@@ -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:
index e338580..8f6dc7e 100644 (file)
@@ -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'] == {}:
index 4f13913..38904dc 100644 (file)
@@ -134,7 +134,9 @@ class XHTMLWriter:
                if self.parent:
                        output  +=      '<h2>Feeds</h2>\n'
                        output  +=      '<p>\n'
-                       for blog in self.parent.blogs:
+                       blogscopy       = self.parent.blogs + []
+                       blogscopy.sort(self.__blog_sort__)
+                       for blog in blogscopy:
                                output  += '<a href="%s">%s</a> (<a href="%s">feed</a>)<br />\n' % (blog.blogURL, blog.blogTitle, blog.feedURL)
                        output  +=      '</p>\n'
                output  +=      '</div>\n'
@@ -160,3 +162,9 @@ class XHTMLWriter:
                output  +=      '</body>\n'
                output  +=      '</html>'
                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
index 584a545..01f74ed 100644 (file)
--- 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

UCC git Repository :: git.ucc.asn.au