jenkins-bot has submitted this change and it was merged.

Change subject: Fix notifications building from JSON
......................................................................


Fix notifications building from JSON

Sometimes (like in welcome messages), notifications don't have a
'title' property, so we shouldn't assume there is one.

Bug: T139015
Change-Id: I83e480d04e8e09aa9bcb5edef4f56b47d150e199
---
M pywikibot/echo.py
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/echo.py b/pywikibot/echo.py
index 8c9584a..f9fa001 100644
--- a/pywikibot/echo.py
+++ b/pywikibot/echo.py
@@ -27,8 +27,10 @@
         notif.category = data['category']
         notif.timestamp = 
pywikibot.Timestamp.fromtimestampformat(data['timestamp']['mw'])
 
-        # TODO: use 'namespace-key' + 'text' ?
-        notif.page = pywikibot.Page(site, data['title']['full'])
+        if 'title' in data and 'full' in data['title']:
+            notif.page = pywikibot.Page(site, data['title']['full'])
+        else:
+            notif.page = None
 
         if 'agent' in data and 'name' in data['agent']:
             notif.agent = pywikibot.User(site, data['agent']['name'])

-- 
To view, visit https://gerrit.wikimedia.org/r/296688
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I83e480d04e8e09aa9bcb5edef4f56b47d150e199
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: APerson <danielhg...@gmail.com>
Gerrit-Reviewer: John Vandenberg <jay...@gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to