def token_links_factory(token):
    """Links factory for token views."""
    rec = token.get_record()
    links = dict(
        # token_detail=url_for('oarepo_tokens.token_detail', token_id=token.id, _external=True),
    )
    if rec is not None:
        links['record'] = rec.canonical_url
        links['files'] = f"{rec.canonical_url}/files/"
        links['revoke'] = f"{rec.canonical_url}/revoke_token/{token.id}"
        links['init_upload'] = f"{links['files']}?multipart=true"
    return links