From 19a4a78a132cbf96ed4a899f78a2147015337447 Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Mon, 10 Jun 2013 23:43:24 +0200 Subject: [PATCH] `Notification().who()` now returns list of guids af all users mentioned in notification (not only first one). --- diaspy/models.py | 8 +++----- manual/notifications.mdown | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/diaspy/models.py b/diaspy/models.py index 25ad16d..ec798cc 100644 --- a/diaspy/models.py +++ b/diaspy/models.py @@ -82,16 +82,14 @@ class Notification(): return '{0}: {1}'.format(self.when(), str(self)) def who(self): - """Returns guid of user who caused you to get the notification. + """Returns list of guids of the users who caused you to get the notification. """ - who = self._who_regexp.search(self.data['note_html']).group(0) - return who[8:24] + return [who[8:24] for who in self._who_regexp.findall(self.data['note_html'])] def when(self): """Returns UTC time as found in note_html. """ - when = self._when_regexp.search(self.data['note_html']).group(0) - return when + return self._when_regexp.search(self.data['note_html']).group(0) def mark(self, unread=False): """Marks notification to read/unread. diff --git a/manual/notifications.mdown b/manual/notifications.mdown index 7f0d6e7..057f7ae 100644 --- a/manual/notifications.mdown +++ b/manual/notifications.mdown @@ -12,7 +12,7 @@ Single notification (it should be obvious that it requires object of its own) is ##### 1. `who()` -This method will return guid of a user who caused you to get this notification. +This method will return list of guids of the users who caused you to get this notification. ##### 2. `when()` -- 2.25.1