From 75230a78a60b83e6f38ba054ef59cc3f5a6bebcd Mon Sep 17 00:00:00 2001 From: blitzmann Date: Tue, 12 Jun 2018 20:57:06 -0400 Subject: [PATCH] Do not explicitly add the mutator to the module. Setting the Mutator.module property is sufficient, and prevents from a duplicate one from being added with a None key. --- eos/saveddata/module.py | 5 +++-- eos/saveddata/mutator.py | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 5b4547c9f..1efa44d7f 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -164,8 +164,9 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): if self.__baseItem: for x in self.mutaplasmid.attributes: attr = self.item.attributes[x.name] - if attr.ID not in self.mutators: # create the mutator - self.mutators[attr.ID] = Mutator(self, attr, attr.value) + id = attr.ID + if id not in self.mutators: # create the mutator + Mutator(self, attr, attr.value) # @todo: remove attributes that are no longer part of the mutaplasmid. self.__itemModifiedAttributes.mutators = self.mutators diff --git a/eos/saveddata/mutator.py b/eos/saveddata/mutator.py index 39dd49533..19b13ae22 100644 --- a/eos/saveddata/mutator.py +++ b/eos/saveddata/mutator.py @@ -41,9 +41,13 @@ class Mutator(EqBase): """ def __init__(self, module, attr, value): + # this needs to be above module assignment, as assigning the module will add it to the list and it via + # relationship and needs this set 4correctly + self.attrID = attr.ID + self.module = module self.moduleID = module.ID - self.attrID = attr.ID + self.__attr = attr self.build() self.value = value # must run after the build(), because the validator requires build() to run first