From de752bb6a204744da3cbc415189e056c59e131cd Mon Sep 17 00:00:00 2001 From: Federico Leva Date: Sun, 20 May 2018 00:27:14 +0300 Subject: [PATCH] Also add contentmodel to the XML of --xmlrevisions --- dumpgenerator.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dumpgenerator.py b/dumpgenerator.py index e97a296..12e70eb 100755 --- a/dumpgenerator.py +++ b/dumpgenerator.py @@ -802,7 +802,7 @@ def getXMLRevisions(config={}, session=None, allpages=False): if not config['curonly']: # We have to build the XML manually... # Skip flags, presumably needed to add 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' arvrequest = wikitools.api.APIRequest(site, arvparams) results = arvrequest.queryGen() @@ -872,8 +872,7 @@ def makeXmlFromPage(page): E.id(str(page['pageid'])), ) for rev in page['revisions']: - p.append( - E.revision( + revision = E.revision( E.id(str(rev['revid'])), E.timestamp(rev['timestamp']), E.contributor( @@ -883,8 +882,10 @@ def makeXmlFromPage(page): E.comment(rev['comment']), E.text(rev['*'], space="preserve", bytes=str(rev['size'])), E.sha1(rev['sha1']), - ) ) + if 'contentmodel' in rev: + revision.append(E.model) + p.append(revision) return etree.tostring(p, pretty_print=True) def readTitles(config={}, start=None):