jenkins-bot has submitted this change and it was merged.
Change subject: [IMPR] UploadEntry class retrieve FilePage for page() method. ......................................................................
[IMPR] UploadEntry class retrieve FilePage for page() method.
change site.py and page.py accordingly
Change-Id: I84e3db3ace905508659cc23b45cec75bac0e53ab --- M pywikibot/logentries.py M pywikibot/page.py M pywikibot/site.py 3 files changed, 16 insertions(+), 3 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py index 825f166..c97cab6 100644 --- a/pywikibot/logentries.py +++ b/pywikibot/logentries.py @@ -248,6 +248,20 @@
_expectedType = 'upload'
+ def page(self): + """ + FilePage on which action was performed. + + Note: title may be missing in data dict e.g. by oversight action to + hide the title. In that case a KeyError exception will raise + + @rtype: FilePage + @raise: KeyError: title was missing from log entry + """ + if not hasattr(self, '_page'): + self._page = pywikibot.FilePage(self.site, self.data['title']) + return self._page +
class MoveEntry(LogEntry):
diff --git a/pywikibot/page.py b/pywikibot/page.py index 5c0ee75..470d118 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -3048,7 +3048,7 @@ raise StopIteration for item in self.site.logevents( logtype='upload', user=self.username, total=total): - yield (FilePage(self.site, item.title().title()), + yield (item.page(), unicode(item.timestamp()), item.comment(), item.pageid() > 0 diff --git a/pywikibot/site.py b/pywikibot/site.py index 4e87cb6..2ae2aa2 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -5452,8 +5452,7 @@ for event in self.logevents(logtype="upload", user=user, start=start, end=end, reverse=reverse, step=step, total=total): - # event.title() actually returns a Page - filepage = pywikibot.FilePage(event.title()) + filepage = event.page() date = event.timestamp() user = event.user() comment = event.comment() or u''