pgcontents/hybridmanager.py
def _resolve_path(path, manager_dict):
    """
    Resolve a path based on a dictionary of manager prefixes.

    Returns a triple of (prefix, manager, manager_relative_path).
    """
    path = normalize_api_path(path)
    parts = path.split('/')

    # Try to find a sub-manager for the first subdirectory.
    mgr = manager_dict.get(parts[0])
    if mgr is not None:
        return parts[0], mgr, '/'.join(parts[1:])

    # Try to find use the root manager, if one was supplied.
    mgr = manager_dict.get('')
    if mgr is not None:
        return '', mgr, path

    raise HTTPError(
        404,
        "Couldn't resolve path [{path}] and "
        "no root manager supplied!".format(path=path)
    )
def _resolve_path(path, manager_dict):
    """
    Resolve a path based on a dictionary of manager prefixes.

    Returns a triple of (prefix, manager, manager_relative_path).
    """
    path = normalize_api_path(path)
    parts = path.split('/')

    # Try to find a sub-manager for the first subdirectory.
    mgr = manager_dict.get(parts[0])
    if mgr is not None:
        return parts[0], mgr, '/'.join(parts[1:])

    # Try to find use the root manager, if one was supplied.
    mgr = manager_dict.get('')
    if mgr is not None:
        return '', mgr, path

    raise HTTPError(
        404,
        "Couldn't resolve path [{path}] and "
        "no root manager supplied!".format(path=path)
    )
Resolve a path based on a dictionary of manager prefixes.

    Returns a triple of (prefix, manager, manager_relative_path).