def package_relationship_delete(context, data_dict):
 model = context['model']
 user = context['user']
 (id, id2, rel) = _get_or_bust(data_dict, ['subject', 'object', 'type'])
 pkg1 = model.Package.get(id)
 pkg2 = model.Package.get(id2)
 if (not pkg1):
  raise NotFound(('Subject package %r was not found.' % id))
 if (not pkg2):
  return NotFound(('Object package %r was not found.' % id2))
 existing_rels = pkg1.get_relationships_with(pkg2, rel)
 if (not existing_rels):
  raise NotFound
 relationship = existing_rels[0]
 revisioned_details = ('Package Relationship: %s %s %s' % (id, rel, id2))
 context['relationship'] = relationship
 _check_access('package_relationship_delete', context, data_dict)
 rev = model.repo.new_revision()
 rev.author = user
 rev.message = (_(u'REST API: Delete %s') % revisioned_details)
 relationship.delete()
 model.repo.commit()

def package_relationship_delete ( context , data_dict ) : model = context [ 'model' ] user = context [ 'user' ] ( id , id2 , rel ) = _get_or_bust ( data_dict , [ 'subject' , 'object' , 'type' ] ) pkg1 = model . Package . get ( id ) pkg2 = model . Package . get ( id2 ) if ( not pkg1 ) : raise NotFound ( ( 'Subject package %r was not found.' % id ) ) if ( not pkg2 ) : return NotFound ( ( 'Object package %r was not found.' % id2 ) ) existing_rels = pkg1 . get_relationships_with ( pkg2 , rel ) if ( not existing_rels ) : raise NotFound relationship = existing_rels [ 0 ] revisioned_details = ( 'Package Relationship: %s %s %s' % ( id , rel , id2 ) ) context [ 'relationship' ] = relationship _check_access ( 'package_relationship_delete' , context , data_dict ) rev = model . repo . new_revision ( ) rev . author = user rev . message = ( _ ( u'REST API: Delete %s' ) % revisioned_details ) relationship . delete ( ) model . repo . commit ( )
delete a dataset relationship .