def list(): """ generates a page listing claims - ids (should change this) are links to the edit page for the claim """ from claim_tools import make_claim_url, make_participant_url claims = db().select(db.claim.ALL, orderby=db.claim.id) results = [] for claim in claims: primary = get_primary_participant(claim) pub = db.publication(claim.publication) if primary: item = {'id': claim.id, 'link': make_participant_url(claim.id, primary), 'behavior': claim.publication_behavior, 'participant': render_participant(primary), 'publication_authors': pub.author_list, 'publication_year': pub.publication_year } else: item = {'id': claim.id, 'link': make_claim_url(claim.id), 'behavior': claim.publication_behavior, 'publication_authors': pub.author_list, 'publication_year': pub.publication_year } results.append(item) return {"items": results}
def make_link_table(claim): """generates a set of records that each will correspond to a row of a display table with links to edit pages for each participant in the claim""" from claim_tools import make_claim_url, make_participant_url rows = db(db.participant2claim.claim == claim.id).select() result = [] for row in rows: part = row.participant print "row.id: {}".format(row.id) print "row.property: {}".format(row.property) item = {'claim': row.claim, 'property': db.property(row.property).label, 'participant': render_participant(db.participant(part)), 'participant_link': make_participant_url(claim.id, part) } result.append(item) print "table = {}".format(str(result)) return result