def insert(self, identified):
        """
        Inserts an already-created identified object of the expected class.
        """

        if not isinstance(identified, self._class):
            raise self.Error("Passed instance is not of the needed class",
                             self.Error.INVALID_INSTANCE_CLASS, instance=identified)

        try:
            if self._objects[identified.key] != identified:
                raise self.Error("Passes instance's key '%s' is already occupied" % identified.key,
                                 self.Error.KEY_EXISTS, key=identified.key, instance=identified)
        except KeyError:
            self._objects[identified.key] = identified
            self._events.insert.trigger(list=self, instance=identified)
        return identified
def insert ( self , identified ) : if not isinstance ( identified , self . _class ) : raise self . Error ( "Passed instance is not of the needed class" , self . Error . INVALID_INSTANCE_CLASS , instance = identified ) try : if self . _objects [ identified . key ] != identified : raise self . Error ( "Passes instance's key '%s' is already occupied" % identified . key , self . Error . KEY_EXISTS , key = identified . key , instance = identified ) except KeyError : self . _objects [ identified . key ] = identified self . _events . insert . trigger ( list = self , instance = identified ) return identified
Inserts an already-created identified object of the expected class.