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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user