Retain bozo and format

This commit is contained in:
Sam Ruby 2006-09-19 09:55:23 -04:00
parent 61b0722fb0
commit 9c56880e8d
3 changed files with 8 additions and 4 deletions

View File

@ -162,7 +162,7 @@ def content(xentry, name, detail, bozo):
xentry.appendChild(xcontent)
def source(xsource, source, bozo):
def source(xsource, source, bozo, format):
""" copy source information to the entry """
xdoc = xsource.ownerDocument
@ -193,6 +193,9 @@ def source(xsource, source, bozo):
if key.startswith('planet_'):
createTextElement(xsource, key.replace('_',':',1), value)
createTextElement(xsource, 'planet_bozo', bozo and 'true' or 'false')
createTextElement(xsource, 'planet_format', format)
def reconstitute(feed, entry):
""" create an entry document from a parsed feed """
xdoc=minidom.parseString('<entry xmlns="http://www.w3.org/2005/Atom"/>\n')
@ -222,7 +225,7 @@ def reconstitute(feed, entry):
author(xentry, 'contributor', contributor)
xsource = xdoc.createElement('source')
source(xsource, entry.get('source', feed.feed), bozo)
source(xsource, entry.get('source', feed.feed), bozo, feed.version)
xentry.appendChild(xsource)
return xdoc

View File

@ -238,7 +238,7 @@ def spiderFeed(feed):
if not os.path.exists(sources): os.makedirs(sources)
xdoc=minidom.parseString('''<feed xmlns:planet="%s"
xmlns="http://www.w3.org/2005/Atom"/>\n''' % planet.xmlns)
reconstitute.source(xdoc.documentElement, data.feed, data.bozo)
reconstitute.source(xdoc.documentElement,data.feed,data.bozo,data.version)
write(xdoc.toxml('utf-8'), filename(sources, feed))
xdoc.unlink()

View File

@ -65,7 +65,8 @@ def splice():
if not data.feed: continue
xdoc=minidom.parseString('''<planet:source xmlns:planet="%s"
xmlns="http://www.w3.org/2005/Atom"/>\n''' % planet.xmlns)
reconstitute.source(xdoc.documentElement, data.feed, data.bozo)
reconstitute.source(xdoc.documentElement, data.feed,
data.bozo, data.version)
feed.appendChild(xdoc.documentElement)
return doc