Mpaa has uploaded a new change for review.
https://gerrit.wikimedia.org/r/245187
Change subject: site.loadrevisions():request contentmodel and sha1 from proper
MW version
......................................................................
site.loadrevisions():request contentmodel and sha1 from proper MW version
Request contentmodel only from MW >=1.21 and sha1 from MW >= 1.19.
Support for these params has been inserted in such versions.
Change-Id: I4d5384f9ee10a909fa7684181dbac6ac71320982
---
M pywikibot/data/api.py
M pywikibot/site.py
2 files changed, 6 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/87/245187/1
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 8ce923b..c932613 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -3061,8 +3061,6 @@
page._protection[item['type']] = item['level'], item['expiry']
if 'revisions' in pagedict:
# TODO: T102735: Use the page content model for <1.21
- # TODO: Add rvprop 'contentmodel' to all revisions calls, but only
- # on 1.21+ otherwise it causes API warnings
for rev in pagedict['revisions']:
assert 'parentid' in rev, 'parentid missing in revision %r' % rev
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 25dedf7..2a1ea8e 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3668,8 +3668,13 @@
rvargs = {'type_arg': 'info|revisions'}
+ rvargs['rvprop'] = 'ids|timestamp|flags|comment|user'
+ if MediaWikiVersion(self.version()) >= MediaWikiVersion('1.21'):
+ rvargs['rvprop'] += '|contentmodel'
+ if MediaWikiVersion(self.version()) >= MediaWikiVersion('1.19'):
+ rvargs['rvprop'] += '|sha1'
if getText:
- rvargs[u"rvprop"] =
u"ids|flags|timestamp|user|comment|content|sha1"
+ rvargs['rvprop'] += '|content'
if section is not None:
rvargs[u"rvsection"] = unicode(section)
if rollback:
--
To view, visit https://gerrit.wikimedia.org/r/245187
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d5384f9ee10a909fa7684181dbac6ac71320982
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits