jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/361017 )
Change subject: Create superclass for log entries with user targets
......................................................................
Create superclass for log entries with user targets
This superclass will override the user() method so it returns a
User object instead of a Page object.
Change-Id: Iccce2364e67dc8e4975cea9b07c782d58a700b2f
---
M pywikibot/logentries.py
1 file changed, 16 insertions(+), 11 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 22cc434..80cf38c 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -129,6 +129,21 @@
return self.data['comment']
+class UserTargetLogEntry(LogEntry):
+
+ """A log entry whose target is a user page."""
+
+ def page(self):
+ """Return the target user.
+
+ This returns a User object instead of the Page object returned by the
+ superclass method.
+ """
+ if not hasattr(self, '_page'):
+ self._page = pywikibot.User(super(UserTargetLogEntry, self).page())
+ return self._page
+
+
class BlockEntry(LogEntry):
"""
@@ -361,21 +376,11 @@
_expectedType = 'newusers'
-class ThanksEntry(LogEntry):
+class ThanksEntry(UserTargetLogEntry):
"""Thanks log entry."""
_expectedType = 'thanks'
-
- def page(self):
- """Return the target user.
-
- This returns a User object instead of the Page object returned by the
- superclass method.
- """
- if not hasattr(self, '_page'):
- self._page = pywikibot.User(super(ThanksEntry, self).page())
- return self._page
# TODO entries for merge,suppress,makebot,gblblock,renameuser,globalauth,gblrights ?
--
To view, visit
https://gerrit.wikimedia.org/r/361017
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iccce2364e67dc8e4975cea9b07c782d58a700b2f
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Happy5214 <happy5214(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>