Feedlist Updates
[planet-ucc.git] / XMLWriter.py
index 80270b2..38904dc 100644 (file)
@@ -96,7 +96,7 @@ class XHTMLWriter:
                output  +=      '<p class="time">\n'
                if item.imageURL:
                        output += '<a class="image" href="%s"><img class="image" src="%s" alt="%s" /></a>\n' % (item.imageLink, item.imageURL, item.blogTitle)
-               output  +=      '(<a href="%s">%s</a>)\n' % (item.itemURL ,time.strftime('%A %B %d, %Y %H:%M %Z', time.localtime(item.itemDate)))
+               output  +=      '(<a href="%s">%s</a>)\n' % (item.itemURL ,time.strftime('%A %B %d, %Y %H:%M AWST', time.localtime(item.itemDate)))
                output  +=      '</p>\n'
                output  +=      '<p class="body">\n'
                output  +=      item.contents
@@ -129,13 +129,15 @@ class XHTMLWriter:
                        pass
                output  +=      '<h2>Last Updated</h2>\n'
                output  +=      '<p>\n'
-               output  +=      '%s\n' % time.strftime('%A %B %d, %Y %H:%M', time.localtime())
+               output  +=      '%s\n' % time.strftime('%A %B %d, %Y %H:%M AWST', time.localtime())
                output  +=      '</p>\n'
                if self.parent:
                        output  +=      '<h2>Feeds</h2>\n'
                        output  +=      '<p>\n'
-                       for blog in self.parent.blogs:
-                               output  += '<a href="%s">%s</a><br />\n' % (blog.blogURL, blog.blogTitle)
+                       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'
                output  +=      '<div class="items">\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

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