def add(self, layer, items):
        """
        Add items in model.
        """
        for k in items.iterkeys():
            if k in self.model[layer]:
                raise Exception('item %s is already in layer %s' % (k, layer))
        self.model[layer].update(items)
        # this should also update Layer.layer, the layer data
        # same as calling layer constructor
        # so now just need to add items to the layer
        for k, v in items.iteritems():
            getattr(self, layer).add(k, v['module'], v.get('package'))
def add ( self , layer , items ) : for k in items . iterkeys ( ) : if k in self . model [ layer ] : raise Exception ( 'item %s is already in layer %s' % ( k , layer ) ) self . model [ layer ] . update ( items ) for k , v in items . iteritems ( ) : getattr ( self , layer ) . add ( k , v [ 'module' ] , v . get ( 'package' ) )
Add items in model.