(self, model, key='name', fields=None)
return
Merge another table model with this one based on a key field,
           we only add records from the new model where the key is present
           in both models
Merge another table model with this one based on a key field,
           we only add records from the new model where the key is present
           in both models
Merge another table model with this one based on a key field we only add records from the new model where the key is present in both models
def merge(self, model, key='name', fields=None):
        """Merge another table model with this one based on a key field,
           we only add records from the new model where the key is present
           in both models"""
        if fields == None: fields = model.columnNames
        for rec in self.reclist:
            if not key in self.data[rec]:
                continue
            for new in model.reclist:
                if not key in model.data[new]:
                    continue
                if self.data[rec][key] == model.data[new][key]:
                #if new == rec:
                    for f in fields:
                        if not f in model.data[rec]:
                            continue
                        if not f in self.columnNames:
                            self.addColumn(f)
                        self.data[rec][f] = model.data[rec][f]
        return
def merge ( self , model , key = 'name' , fields = None ) : if fields == None : fields = model . columnNames for rec in self . reclist : if not key in self . data [ rec ] : continue for new in model . reclist : if not key in model . data [ new ] : continue if self . data [ rec ] [ key ] == model . data [ new ] [ key ] : #if new == rec: for f in fields : if not f in model . data [ rec ] : continue if not f in self . columnNames : self . addColumn ( f ) self . data [ rec ] [ f ] = model . data [ rec ] [ f ] return