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.
This commit is contained in:
Philipp Hörist 2017-07-24 23:24:39 +02:00
parent 89367a83ec
commit aefb571168
1 changed files with 6 additions and 1 deletions

View File

@ -154,8 +154,13 @@ class NetworkEvent(object):
def _set_kwargs_as_attributes(self, **kwargs):
for k, v in kwargs.items():
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 = []