Also add contentmodel to the XML of --xmlrevisions

pull/319/head
Federico Leva 6 years ago
parent f7466850c9
commit de752bb6a2

@ -802,7 +802,7 @@ def getXMLRevisions(config={}, session=None, allpages=False):
if not config['curonly']: if not config['curonly']:
# We have to build the XML manually... # We have to build the XML manually...
# Skip flags, presumably needed to add <minor/> which is in the schema. # Skip flags, presumably needed to add <minor/> which is in the schema.
# Also missing is the parentid. # Also missing: parentid and contentformat.
arvparams['arvprop'] = 'ids|timestamp|user|userid|size|sha1|contentmodel|comment|content' arvparams['arvprop'] = 'ids|timestamp|user|userid|size|sha1|contentmodel|comment|content'
arvrequest = wikitools.api.APIRequest(site, arvparams) arvrequest = wikitools.api.APIRequest(site, arvparams)
results = arvrequest.queryGen() results = arvrequest.queryGen()
@ -872,8 +872,7 @@ def makeXmlFromPage(page):
E.id(str(page['pageid'])), E.id(str(page['pageid'])),
) )
for rev in page['revisions']: for rev in page['revisions']:
p.append( revision = E.revision(
E.revision(
E.id(str(rev['revid'])), E.id(str(rev['revid'])),
E.timestamp(rev['timestamp']), E.timestamp(rev['timestamp']),
E.contributor( E.contributor(
@ -883,8 +882,10 @@ def makeXmlFromPage(page):
E.comment(rev['comment']), E.comment(rev['comment']),
E.text(rev['*'], space="preserve", bytes=str(rev['size'])), E.text(rev['*'], space="preserve", bytes=str(rev['size'])),
E.sha1(rev['sha1']), E.sha1(rev['sha1']),
)
) )
if 'contentmodel' in rev:
revision.append(E.model)
p.append(revision)
return etree.tostring(p, pretty_print=True) return etree.tostring(p, pretty_print=True)
def readTitles(config={}, start=None): def readTitles(config={}, start=None):

Loading…
Cancel
Save