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.

This commit is contained in:
blitzmann
2018-06-12 20:57:06 -04:00
parent fccd4b61f4
commit 75230a78a6
2 changed files with 8 additions and 3 deletions

View File

@@ -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

View File

@@ -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