jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/482507 )
Change subject: [IMPR] echo.py: create notif.event_id ......................................................................
[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(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
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)