X-Git-Url: https://git.ucc.asn.au/?p=planet-ucc.git;a=blobdiff_plain;f=XMLWriter.py;h=4f13913ee6d7e5ac013621f9f72e26038b26733f;hp=1311fb68631723a1ab03defcde68c5f3fffaa6d2;hb=783caef083f5dcafaed71dfa3f3a8035109717e9;hpb=b2d7ed4b39a5a03fb8f264e26b0d04a502928ddf diff --git a/XMLWriter.py b/XMLWriter.py index 1311fb6..4f13913 100644 --- a/XMLWriter.py +++ b/XMLWriter.py @@ -60,7 +60,8 @@ class Planet: if lastItem == None: break # this checks to see if it's a new day - if time.localtime(lastItem.itemDate) != lastDate: + if time.localtime(lastItem.itemDate)[6] != lastDate: + lastDate = time.localtime(lastItem.itemDate)[6] workingDate = PlanetDate(lastItem.itemDate) self.dates.append(workingDate) # append the item to the current date @@ -71,10 +72,12 @@ class Planet: class XMLWriter: def __init__(self, doctype, bloglist): + self.blogs = bloglist self.planet = Planet(bloglist) self.items = self.planet.sort() # doctype should be something like XMLWriter.XHTMLWriter - self.writer = doctype(self.items) + self.writer = doctype(self.items) + self.writer.parent = self def write(self): output = self.writer.write() @@ -83,18 +86,22 @@ class XMLWriter: class XHTMLWriter: def __init__(self, planet): self.planet = planet - self.maxitems = 100 + self.maxitems = 50 + self.parent = None def __write_item__(self, item): output = '' - output += '
\n' - output += '(%s)\n' % time.strftime('%A %B %d, %Y %H:%M %Z', time.localtime(item.itemDate)) + if item.imageURL: + output += '\n' % (item.imageLink, item.imageURL, item.blogTitle) + output += '(%s)\n' % (item.itemURL ,time.strftime('%A %B %d, %Y %H:%M AWST', time.localtime(item.itemDate))) output += '
\n' output += '\n' output += item.contents output += '\n
\n' + output += '