Exemple #1
0
 def createChildByID(self, class_id, *args, **kwargs):
     if not object_registry.isValidChild(self.class_id, class_id):
         raise errors.SiptrackError(
                 'trying to create child of invalid type \'%s\' for type \'%s\' (oid: %s)' % (class_id, self.class_id, self.oid))
     child = object_registry.createObject(class_id, self, *args, **kwargs)
     self.children.append(child)
     self._children_sorted = False
     return child
Exemple #2
0
 def createChildByID(self, class_id, *args, **kwargs):
     if not object_registry.isValidChild(self.class_id, class_id):
         raise errors.SiptrackError(
             'trying to create child of invalid type \'%s\' for type \'%s\' (oid: %s)'
             % (class_id, self.class_id, self.oid))
     child = object_registry.createObject(class_id, self, *args, **kwargs)
     self.children.append(child)
     self._children_sorted = False
     return child
Exemple #3
0
    def loadChildren(self, transport_data, force = False):
        for node_data in transport_data:
            if node_data['oid'] in self.oid_mapping:
                # If force, have the node reload it's data even if it
                # already exists.
                if force is True:
                    self.oid_mapping[node_data['oid']]._loaded(node_data)
#                print 'trying to add existing oid:', node_data['oid']
                continue
            parent = self._getOID(node_data['parent'])
            # If we don't have a node for the parent, use the view tree.
            # Ugly..
            if not parent:
                print 'adding to unknown parent:', node_data['parent'], node_data['oid']
                parent = self.view_tree
            if not object_registry.isValidChild(parent.class_id, node_data['class_id']):
                print 'skipping invalid node type:', node_data['class_id'], node_data['oid']
                continue
            parent.loadChild(node_data)
Exemple #4
0
    def loadChildren(self, transport_data, force=False):
        for node_data in transport_data:
            if node_data['oid'] in self.oid_mapping:
                # If force, have the node reload it's data even if it
                # already exists.
                if force is True:
                    self.oid_mapping[node_data['oid']]._loaded(node_data)
#                print 'trying to add existing oid:', node_data['oid']
                continue
            parent = self._getOID(node_data['parent'])
            # If we don't have a node for the parent, use the view tree.
            # Ugly..
            if not parent:
                print 'adding to unknown parent:', node_data[
                    'parent'], node_data['oid']
                parent = self.view_tree
            if not object_registry.isValidChild(parent.class_id,
                                                node_data['class_id']):
                print 'skipping invalid node type:', node_data[
                    'class_id'], node_data['oid']
                continue
            parent.loadChild(node_data)