def package_relationships_list(context, data_dict):
 model = context['model']
 api = context.get('api_version')
 id = _get_or_bust(data_dict, 'id')
 id2 = data_dict.get('id2')
 rel = data_dict.get('rel')
 ref_package_by = ('id' if (api == 2) else 'name')
 pkg1 = model.Package.get(id)
 pkg2 = None
 if (not pkg1):
  raise NotFound('First package named in request was not found.')
 if id2:
  pkg2 = model.Package.get(id2)
  if (not pkg2):
   raise NotFound('Second package named in address was not found.')
 if (rel == 'relationships'):
  rel = None
 _check_access('package_relationships_list', context, data_dict)
 relationships = pkg1.get_relationships(with_package=pkg2, type=rel)
 if (rel and (not relationships)):
  raise NotFound(('Relationship "%s %s %s" not found.' % (id, rel, id2)))
 relationship_dicts = [rel.as_dict(pkg1, ref_package_by=ref_package_by) for rel in relationships]
 return relationship_dicts

def package_relationships_list ( context , data_dict ) : model = context [ 'model' ] api = context . get ( 'api_version' ) id = _get_or_bust ( data_dict , 'id' ) id2 = data_dict . get ( 'id2' ) rel = data_dict . get ( 'rel' ) ref_package_by = ( 'id' if ( api == 2 ) else 'name' ) pkg1 = model . Package . get ( id ) pkg2 = None if ( not pkg1 ) : raise NotFound ( 'First package named in request was not found.' ) if id2 : pkg2 = model . Package . get ( id2 ) if ( not pkg2 ) : raise NotFound ( 'Second package named in address was not found.' ) if ( rel == 'relationships' ) : rel = None _check_access ( 'package_relationships_list' , context , data_dict ) relationships = pkg1 . get_relationships ( with_package = pkg2 , type = rel ) if ( rel and ( not relationships ) ) : raise NotFound ( ( 'Relationship "%s %s %s" not found.' % ( id , rel , id2 ) ) ) relationship_dicts = [ rel . as_dict ( pkg1 , ref_package_by = ref_package_by ) for rel in relationships ] return relationship_dicts
return a dataset s relationships .