Xqt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/291605
Change subject: [compat2core] return compat-like list of tuples from
getVersionHistory
......................................................................
[compat2core] return compat-like list of tuples from getVersionHistory
- Page.getVersionHistory() gives a list of tuples with 4 items
but tuple has 6 items in compat.
- getVersionHistory method is deprecated in core but kept for compatibility
with compat scripts. We could change it for that reason and restore
compatibility again.
- enable 'size' and 'tags' properties for Revision class (which is
needed for getVersionHistory).
Bug: T136513
Change-Id: I740ee61aedb95795f294918000f039a4b4db2fca
---
M pywikibot/data/api.py
M pywikibot/page.py
M pywikibot/site.py
3 files changed, 12 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/05/291605/1
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 62ec818..edf206d 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -3163,7 +3163,9 @@
rollbacktoken=rev.get('rollbacktoken', None),
parentid=rev.get('parentid'),
contentmodel=rev.get('contentmodel', None),
- sha1=rev.get('sha1', None)
+ sha1=rev.get('sha1', None),
+ size=rev['size'],
+ tags=rev['tags']
)
page._revisions[revision.revid] = revision
diff --git a/pywikibot/page.py b/pywikibot/page.py
index a59d379..0a68f55 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -4699,7 +4699,9 @@
HistEntry = namedtuple('HistEntry', ['revid',
'timestamp',
'user',
- 'comment'])
+ 'comment',
+ 'size',
+ 'tags'])
FullHistEntry = namedtuple('FullHistEntry', ['revid',
'timestamp',
@@ -4709,7 +4711,7 @@
def __init__(self, revid, timestamp, user, anon=False, comment=u"",
text=None, minor=False, rollbacktoken=None, parentid=None,
- contentmodel=None, sha1=None):
+ contentmodel=None, sha1=None, size=-1, tags=None):
"""
Constructor.
@@ -4750,6 +4752,8 @@
self._parent_id = parentid
self._content_model = contentmodel
self._sha1 = sha1
+ self.size = size
+ self.tags = tags if tags is not None else []
@property
def parent_id(self):
@@ -4811,7 +4815,7 @@
def hist_entry(self):
"""Return a namedtuple with a Page history record."""
return Revision.HistEntry(self.revid, self.timestamp, self.user,
- self.comment)
+ self.comment, self.size, self.tags)
def full_hist_entry(self):
"""Return a namedtuple with a Page full history record."""
diff --git a/pywikibot/site.py b/pywikibot/site.py
index ce7f628..a6253b1 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3765,7 +3765,8 @@
rvargs = {'type_arg': 'info|revisions'}
- rvargs['rvprop'] = ['ids', 'timestamp', 'flags', 'comment', 'user']
+ rvargs['rvprop'] = ['ids', 'timestamp', 'flags', 'comment', 'user',
+ 'size', 'tags']
if MediaWikiVersion(self.version()) >= MediaWikiVersion('1.21'):
rvargs['rvprop'].append('contentmodel')
if MediaWikiVersion(self.version()) >= MediaWikiVersion('1.19'):
--
To view, visit https://gerrit.wikimedia.org/r/291605
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I740ee61aedb95795f294918000f039a4b4db2fca
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits