Retain bozo and format
This commit is contained in:
parent
61b0722fb0
commit
9c56880e8d
@ -162,7 +162,7 @@ def content(xentry, name, detail, bozo):
|
|||||||
|
|
||||||
xentry.appendChild(xcontent)
|
xentry.appendChild(xcontent)
|
||||||
|
|
||||||
def source(xsource, source, bozo):
|
def source(xsource, source, bozo, format):
|
||||||
""" copy source information to the entry """
|
""" copy source information to the entry """
|
||||||
xdoc = xsource.ownerDocument
|
xdoc = xsource.ownerDocument
|
||||||
|
|
||||||
@ -193,6 +193,9 @@ def source(xsource, source, bozo):
|
|||||||
if key.startswith('planet_'):
|
if key.startswith('planet_'):
|
||||||
createTextElement(xsource, key.replace('_',':',1), value)
|
createTextElement(xsource, key.replace('_',':',1), value)
|
||||||
|
|
||||||
|
createTextElement(xsource, 'planet_bozo', bozo and 'true' or 'false')
|
||||||
|
createTextElement(xsource, 'planet_format', format)
|
||||||
|
|
||||||
def reconstitute(feed, entry):
|
def reconstitute(feed, entry):
|
||||||
""" create an entry document from a parsed feed """
|
""" create an entry document from a parsed feed """
|
||||||
xdoc=minidom.parseString('<entry xmlns="http://www.w3.org/2005/Atom"/>\n')
|
xdoc=minidom.parseString('<entry xmlns="http://www.w3.org/2005/Atom"/>\n')
|
||||||
@ -222,7 +225,7 @@ def reconstitute(feed, entry):
|
|||||||
author(xentry, 'contributor', contributor)
|
author(xentry, 'contributor', contributor)
|
||||||
|
|
||||||
xsource = xdoc.createElement('source')
|
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)
|
xentry.appendChild(xsource)
|
||||||
|
|
||||||
return xdoc
|
return xdoc
|
||||||
|
@ -238,7 +238,7 @@ def spiderFeed(feed):
|
|||||||
if not os.path.exists(sources): os.makedirs(sources)
|
if not os.path.exists(sources): os.makedirs(sources)
|
||||||
xdoc=minidom.parseString('''<feed xmlns:planet="%s"
|
xdoc=minidom.parseString('''<feed xmlns:planet="%s"
|
||||||
xmlns="http://www.w3.org/2005/Atom"/>\n''' % planet.xmlns)
|
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))
|
write(xdoc.toxml('utf-8'), filename(sources, feed))
|
||||||
xdoc.unlink()
|
xdoc.unlink()
|
||||||
|
|
||||||
|
@ -65,7 +65,8 @@ def splice():
|
|||||||
if not data.feed: continue
|
if not data.feed: continue
|
||||||
xdoc=minidom.parseString('''<planet:source xmlns:planet="%s"
|
xdoc=minidom.parseString('''<planet:source xmlns:planet="%s"
|
||||||
xmlns="http://www.w3.org/2005/Atom"/>\n''' % planet.xmlns)
|
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)
|
feed.appendChild(xdoc.documentElement)
|
||||||
|
|
||||||
return doc
|
return doc
|
||||||
|
Loading…
Reference in New Issue
Block a user