PEATDB/TableModels.py
def merge(self, model, key='name', fields=None):
        """Merge another table model with this one based on a key field, 
           we only add nrecords 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 self.data[rec].has_key(key):
                continue
            for new in model.reclist:
                if not model.data[new].has_key(key):
                    continue
                if self.data[rec][key] == model.data[new][key]:
                #if new == rec:                                   
                    for f in fields:
                        if not model.data[rec].has_key(f):
                            continue
                        if not f in self.columnNames:
                            self.addColumn(f)                        
                        self.data[rec][f] = model.data[rec][f]       
        return
Merge another table model with this one based on a key field, 
           we only add nrecords 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 nrecords 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 nrecords from the new model where the key is present in both models
def merge(self, model, key='name', fields=None):
        if fields == None: fields = model.columnNames
        for rec in self.reclist:
            if not self.data[rec].has_key(key):
                continue
            for new in model.reclist:
                if not model.data[new].has_key(key):
                    continue
                if self.data[rec][key] == model.data[new][key]:
                    for f in fields:
                        if not model.data[rec].has_key(f):
                            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 self . data [ rec ] . has_key ( key ) : continue for new in model . reclist : if not model . data [ new ] . has_key ( key ) : continue if self . data [ rec ] [ key ] == model . data [ new ] [ key ] : for f in fields : if not model . data [ rec ] . has_key ( f ) : continue if not f in self . columnNames : self . addColumn ( f ) self . data [ rec ] [ f ] = model . data [ rec ] [ f ] return
Merge another table model with this one based on a key field,
we only add nrecords 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 nrecords 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 nrecords from the new model where the key is present
           in both models""" #if new == rec:                                   
self
model
key
fields