jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[IMPR] echo.py: create notif.event_id

- created a new event_id property, the notification id as integer
- deprecated existing id one, that is in unicode

Change-Id: I2ee0567110824bcc1a7eb61659e5d6eb0f3f0584
---
M pywikibot/echo.py
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/pywikibot/echo.py b/pywikibot/echo.py
index 945f061..0b4604a 100644
--- a/pywikibot/echo.py
+++ b/pywikibot/echo.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Classes and functions for working with the Echo extension."""
#
-# (C) Pywikibot team, 2014-2018
+# (C) Pywikibot team, 2014-2019
#
# Distributed under the terms of the MIT license.
#
@@ -9,6 +9,8 @@

import pywikibot

+from pywikibot.tools import deprecated
+

class Notification(object):

@@ -27,7 +29,7 @@
"""
notif = cls(site)

- notif.id = data['id'] # TODO: use numeric id ?
+ notif.event_id = int(data['id'])
notif.type = data['type']
notif.category = data['category']
notif.timestamp = pywikibot.Timestamp.fromtimestampformat(
@@ -53,6 +55,16 @@

return notif

+ @property
+ @deprecated('event_id', since='20190106')
+ def id(self):
+ """
+ DEPRECATED: Return notification id as unicode.
+
+ @rtype: unicode
+ """
+ return str(self.event_id)
+
def mark_as_read(self):
"""Mark the notification as read."""
return self.site.notifications_mark_read(list=self.id)

To view, visit change 482507. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2ee0567110824bcc1a7eb61659e5d6eb0f3f0584
Gerrit-Change-Number: 482507
Gerrit-PatchSet: 9
Gerrit-Owner: Framawiki <framawiki@tools.wmflabs.org>
Gerrit-Reviewer: Framawiki <framawiki@tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)