def _find_master(self): ctrl = Controller() master = [] for item in ctrl.keys(): if ctrl[item].models is self: master.append(ctrl[item]) if len(master) > 1: raise Exception('More than one master found! This model dictionary has been associated with multiple objects. To use the same dictionary multiple times use the copy method.') return master[0]
def _find_master(self): ctrl = Controller() master = [] for item in ctrl.keys(): if ctrl[item].models is self: master.append(ctrl[item]) if len(master) > 1: raise Exception( 'More than one master found! This model dictionary has been associated with multiple objects. To use the same dictionary multiple times use the copy method.' ) return master[0]
def _find_master(self): ctrl = Controller() master = [] for item in list(ctrl.keys()): if ctrl[item].models is not None: for model in list(ctrl[item].models.keys()): if ctrl[item].models[model] is self: master.append(ctrl[item]) if len(master) > 1: raise Exception( "More than one master found! This model dictionary " "has been associated with multiple objects. To use " "the same dictionary multiple times use the copy" "method." ) return master[0]