def s3_menu_postp():
    menu_selected = []
    body_id = s3mgr.get_session('dvi', 'body')
    if body_id:
        body = s3db.dvi_body
        query = (body.id == body_id)
        record = db(query).select(body.id, body.pe_label, limitby=(0, 1)).first()
        if record:
            label = record.pe_label
            response.menu_options[(- 3)][(- 1)].append([T(('Candidate Matches for Body %s' % label)), False, URL(f='person', vars=dict(match=record.id))])
            menu_selected.append([('%s: %s' % (T('Body'), label)), False, URL(f='body', args=[record.id])])
    person_id = s3mgr.get_session('pr', 'person')
    if person_id:
        person = s3db.pr_person
        query = (person.id == person_id)
        record = db(query).select(person.id, limitby=(0, 1)).first()
        if record:
            name = s3db.pr_person_represent(record.id)
            menu_selected.append([('%s: %s' % (T('Person'), name)), False, URL(f='person', args=[record.id])])
    if menu_selected:
        menu_selected = [T('Open recent'), True, None, menu_selected]
        response.menu_options.append(menu_selected)
def s3_menu_postp():
    menu_selected = []
    body_id = s3mgr.get_session('dvi', 'body')
    if body_id:
        body = s3db.dvi_body
        query = (body.id == body_id)
        record = db(query).select(body.id, body.pe_label, limitby=(0, 1)).first()
        if record:
            label = record.pe_label
            response.menu_options[(- 3)][(- 1)].append([T(('Candidate Matches for Body %s' % label)), False, URL(f='person', vars=dict(match=record.id))])
            menu_selected.append([('%s: %s' % (T('Body'), label)), False, URL(f='body', args=[record.id])])
    person_id = s3mgr.get_session('pr', 'person')
    if person_id:
        person = s3db.pr_person
        query = (person.id == person_id)
        record = db(query).select(person.id, limitby=(0, 1)).first()
        if record:
            name = s3db.pr_person_represent(record.id)
            menu_selected.append([('%s: %s' % (T('Person'), name)), False, URL(f='person', args=[record.id])])
    if menu_selected:
        menu_selected = [T('Open recent'), True, None, menu_selected]
        response.menu_options.append(menu_selected)