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
(cherry picked from commit d387ab236634f91186805dd114ee85455d1244f8)
---
M pywikibot/echo.py
1 file changed, 4 insertions(+), 2 deletions(-)

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



diff --git a/pywikibot/echo.py b/pywikibot/echo.py
index 311827d..c42ddbb 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/297119
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I83e480d04e8e09aa9bcb5edef4f56b47d150e199
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <[email protected]>
Gerrit-Reviewer: APerson <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to