jenkins-bot merged this change.
[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(-)
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 change 423261. To unsubscribe, visit settings.