def package_delete(context, data_dict):
 model = context['model']
 user = context['user']
 id = _get_or_bust(data_dict, 'id')
 entity = model.Package.get(id)
 if (entity is None):
  raise NotFound
 _check_access('package_delete', context, data_dict)
 rev = model.repo.new_revision()
 rev.author = user
 rev.message = (_(u'REST API: Delete Package: %s') % entity.name)
 for item in plugins.PluginImplementations(plugins.IPackageController):
  item.delete(entity)
  item.after_delete(context, data_dict)
 entity.delete()
 dataset_memberships = model.Session.query(model.Member).filter((model.Member.table_id == id)).filter((model.Member.state == 'active')).all()
 for membership in dataset_memberships:
  membership.delete()
 model.repo.commit()

def package_delete ( context , data_dict ) : model = context [ 'model' ] user = context [ 'user' ] id = _get_or_bust ( data_dict , 'id' ) entity = model . Package . get ( id ) if ( entity is None ) : raise NotFound _check_access ( 'package_delete' , context , data_dict ) rev = model . repo . new_revision ( ) rev . author = user rev . message = ( _ ( u'REST API: Delete Package: %s' ) % entity . name ) for item in plugins . PluginImplementations ( plugins . IPackageController ) : item . delete ( entity ) item . after_delete ( context , data_dict ) entity . delete ( ) dataset_memberships = model . Session . query ( model . Member ) . filter ( ( model . Member . table_id == id ) ) . filter ( ( model . Member . state == 'active' ) ) . all ( ) for membership in dataset_memberships : membership . delete ( ) model . repo . commit ( )
delete a dataset .