From 91a3cc11dec301ba43c7cb6123b4a267c0a79171 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 21 Sep 2007 23:56:11 +0000 Subject: [PATCH] fix type of returns variable in get_events: it's a dict if jid is not given --- src/common/events.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/events.py b/src/common/events.py index db765321a..b9e84e865 100644 --- a/src/common/events.py +++ b/src/common/events.py @@ -160,12 +160,14 @@ class Events: return self._get_nb_events(types = types, account = account) def get_events(self, account, jid = None, types = []): - '''if event is not specified, get all events from this jid, + '''returns all events from the given account of the form + {jid1: [], jid2: []} + if jid is given, returns all events from the given jid in a list: [] optionnaly only from given type''' if not self._events.has_key(account): return [] - events_list = [] # list of events if not jid: + events_list = {} # list of events for jid_ in self._events[account]: events = [] for ev in self._events[account][jid_]: @@ -176,6 +178,7 @@ class Events: return events_list if not self._events[account].has_key(jid): return [] + events_list = [] # list of events for ev in self._events[account][jid]: if not types or ev.type_ in types: events_list.append(ev)