jenkins-bot has submitted this change and it was merged.
Change subject: Improvement for counting user edits ......................................................................
Improvement for counting user edits
- use revisions generator instead of deprecated getVersionHistory
Change-Id: Ib765e0ca0ae15743d52e9cb6c9eee80492848223 --- M scripts/checkimages.py 1 file changed, 2 insertions(+), 12 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py index 19f07e6..6745389 100644 --- a/scripts/checkimages.py +++ b/scripts/checkimages.py @@ -82,7 +82,7 @@ # (C) Kyle/Orgullomoore, 2006-2007 (newimage.py) # (C) Siebrand Mazeland, 2007-2010 # (C) Filnik, 2007-2011 -# (C) Pywikibot team, 2007-2014 +# (C) Pywikibot team, 2007-2015 # # Distributed under the terms of the MIT license. # @@ -875,20 +875,10 @@
def countEdits(self, pagename, userlist): """Function to count the edit of a user or a list of users in a page.""" - # self.botolist if isinstance(userlist, basestring): userlist = [userlist] page = pywikibot.Page(self.site, pagename) - history = page.getVersionHistory() - user_list = list() - - for data in history: - user_list.append(data.user) - number_edits = 0 - - for username in userlist: - number_edits += user_list.count(username) - return number_edits + return sum(1 for rev in page.revisions() if rev.user in userlist)
def checkImageOnCommons(self): """Checking if the file is on commons."""
pywikibot-commits@lists.wikimedia.org