def get_transactions(link, campaigns):
 campaigns = [c for c in campaigns if ((c.trans_id != 0) and (c.link_id == link._id))]
 if (not campaigns):
  return {}
 bids = Bid.lookup(thing_id=link._id)
 bid_dict = {(b.campaign, b.transaction): b for b in bids}
 bids_by_campaign = {c._id: bid_dict[(c._id, c.trans_id)] for c in campaigns}
 return bids_by_campaign

def get_transactions ( link , campaigns ) : campaigns = [ c for c in campaigns if ( ( c . trans_id != 0 ) and ( c . link_id == link . _id ) ) ] if ( not campaigns ) : return { } bids = Bid . lookup ( thing_id = link . _id ) bid_dict = { ( b . campaign , b . transaction ) : b for b in bids } bids_by_campaign = { c . _id : bid_dict [ ( c . _id , c . trans_id ) ] for c in campaigns } return bids_by_campaign
return bids for specified campaigns on the link .