jenkins-bot has submitted this change and it was merged. Change subject: Make Recentchanges be able to return all revisions ......................................................................
Make Recentchanges be able to return all revisions Recentchanges() is supposed to be able to return all revisions. This patch therefore adds a parameter to return all revisions. The default value for this parameter, however, is to return distinct pages, in order to keep backward-compatibility. Bug: 55152 Change-Id: I958be12e1a197a00e197f0746c7ee47960fb952e --- M wikipedia.py 1 file changed, 11 insertions(+), 3 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/wikipedia.py b/wikipedia.py index 45880cc..d431990 100644 --- a/wikipedia.py +++ b/wikipedia.py @@ -8155,7 +8155,7 @@ def recentchanges(self, number=100, rcstart=None, rcend=None, rcshow=None, rcdir='older', rctype='edit|new', namespace=None, includeredirects=True, repeat=False, user=None, - returndict=False, nobots=False): + returndict=False, nobots=False, revision=False): """ Yield recent changes as Page objects uses API call: @@ -8200,6 +8200,9 @@ timestamp (unicode), length (int), an empty unicode string, username or IP address (str), comment (unicode). + If parameter revision is true, this function returns distinct + revisions. If false, it returns only distinct pages. + # TODO: Detection of unregistered users is broken """ if rctype is None: @@ -8231,6 +8234,11 @@ if rctype: params['rctype'] = rctype + if revision: + keyseen = 'revid' + else: + keyseen = 'pageid' + seen = set() while True: data = query.GetData(params, self) @@ -8243,8 +8251,8 @@ "The APIs don't return data, the site may be down") for i in rcData: - if i['pageid'] not in seen: - seen.add(i['pageid']) + if i[keyseen] not in seen: + seen.add(i[keyseen]) page = Page(self, i['title'], defaultNamespace=i['ns']) if 'comment' in i: page._comment = i['comment'] -- To view, visit https://gerrit.wikimedia.org/r/116218 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I958be12e1a197a00e197f0746c7ee47960fb952e Gerrit-PatchSet: 2 Gerrit-Project: pywikibot/compat Gerrit-Branch: master Gerrit-Owner: Nullzero <nullzero.f...@gmail.com> Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com> Gerrit-Reviewer: Xqt <i...@gno.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits