From aefb5711685b3a354146950aca0dc7c56df14b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Mon, 24 Jul 2017 23:24:39 +0200 Subject: [PATCH] Add new NetworkEvents method This lets us attach all attributes of the base event to the new event. Often Events trigger other Events. When that happens we often want to keep all attr from the previous Event, and just continue under a new Event. Until now all attr had to be pulled out of `self.base_event` again. --- gajim/common/nec.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gajim/common/nec.py b/gajim/common/nec.py index b699085c1..af8465870 100644 --- a/gajim/common/nec.py +++ b/gajim/common/nec.py @@ -154,8 +154,13 @@ class NetworkEvent(object): def _set_kwargs_as_attributes(self, **kwargs): for k, v in kwargs.items(): - setattr(self, k, v) + if k not in ('name', 'base_network_events'): + setattr(self, k, v) + def _set_base_event_vars_as_attributes(self, event): + for k, v in vars(event).items(): + if k not in ('name', 'base_network_events'): + setattr(self, k, v) class NetworkIncomingEvent(NetworkEvent): base_network_events = []