jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/423261 )
Change subject: [IMPR] User: Return None for first/last edit/log when there are none
......................................................................
[IMPR] User: Return None for first/last edit/log when there are none
- last_event: Return None when the user has no logevents
- last_edit, first_edit: Return None when the user has no edits
Bug: T191158
Change-Id: I2801d1306eb6d75e07aadec0483690bda2a08d62
---
M pywikibot/page.py
1 file changed, 6 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 20b5491..ec9b3e1 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3491,9 +3491,9 @@
"""Return last user activity.
@return: last user log entry
- @rtype: LogEntry
+ @rtype: LogEntry or None
"""
- return next(iter(self.logevents(total=1)))
+ return next(iter(self.logevents(total=1)), None)
@deprecated("contributions")
@deprecate_arg("limit", "total") # To be consistent with rest of
framework
@@ -3551,9 +3551,9 @@
@return: first user contribution entry
@return tuple of pywikibot.Page, revid, pywikibot.Timestamp, comment
- @rtype: tuple
+ @rtype: tuple or None
"""
- return next(self.contributions(reverse=True, total=1))
+ return next(self.contributions(reverse=True, total=1), None)
@property
def last_edit(self):
@@ -3561,9 +3561,9 @@
@return: last user contribution entry
@return tuple of pywikibot.Page, revid, pywikibot.Timestamp, comment
- @rtype: tuple
+ @rtype: tuple or None
"""
- return next(self.contributions(total=1))
+ return next(self.contributions(total=1), None)
@deprecate_arg("number", "total")
def uploadedImages(self, total=10):
--
To view, visit
https://gerrit.wikimedia.org/r/423261
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2801d1306eb6d75e07aadec0483690bda2a08d62
Gerrit-Change-Number: 423261
Gerrit-PatchSet: 1
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>