Skip to content

action

can_open_in_rv(context) async

Return True if the action can run for the given context.

Source code in server/action.py
47
48
49
50
51
52
53
54
55
56
57
58
59
60
async def can_open_in_rv(context: "ActionContext") -> bool:
    """Return True if the action can run for the given context."""
    project_name = context.project_name
    entity_ids = context.entity_ids or []
    if not project_name:
        return False
    if context.entity_type != "version" or len(entity_ids) != 1:
        return False

    version_id = entity_ids[0]
    representation_id = await _get_rv_workfile_representation_id(
        project_name, version_id
    )
    return representation_id is not None