John Vandenberg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/297119

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/19/297119/1

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: newchange
Gerrit-Change-Id: I83e480d04e8e09aa9bcb5edef4f56b47d150e199
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jay...@gmail.com>
Gerrit-Reviewer: APerson <danielhg...@gmail.com>

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

Reply via email to