Ejemplo n.º 1
0
def prefer_fun_xmodules(identifier, entry_points):
    """
    Make sure that we use the correct FUN xmodule for video in the studio
    """
    from django.conf import settings
    from xmodule.modulestore import prefer_xmodules
    if identifier == 'video' and settings.USE_DM_CLOUD_VIDEO_PLAYER:
        import pkg_resources
        from xblock.core import XBlock
        # These entry points are listed in the setup.py of the dmcloud app
        # Inspired by the XBlock.load_class method
        entry_points = list(pkg_resources.iter_entry_points(XBlock.entry_point, name='dmcloud'))
    return prefer_xmodules(identifier, entry_points)
Ejemplo n.º 2
0
def prefer_fun_xmodules(identifier, entry_points):
    """
    Make sure that we use the correct FUN xmodule for video in the studio
    """
    from django.conf import settings
    from xmodule.modulestore import prefer_xmodules
    if identifier == 'video' and settings.FUN_DEFAULT_VIDEO_PLAYER is not None:
        import pkg_resources
        from xblock.core import XBlock
        # These entry points are listed in the setup.py of the libcast module
        # Inspired by the XBlock.load_class method
        entry_points = list(pkg_resources.iter_entry_points(XBlock.entry_point,
                name=settings.FUN_DEFAULT_VIDEO_PLAYER))
    return prefer_xmodules(identifier, entry_points)
Ejemplo n.º 3
0
def prefer_fun_xmodules(identifier, entry_points):
    """
    Make sure that we use the correct FUN xmodule for video in the studio
    """
    from django.conf import settings
    from xmodule.modulestore import prefer_xmodules
    if identifier == 'video' and settings.FUN_DEFAULT_VIDEO_PLAYER is not None:
        import pkg_resources
        from xblock.core import XBlock
        # These entry points are listed in the setup.py of the libcast module
        # Inspired by the XBlock.load_class method
        entry_points = list(pkg_resources.iter_entry_points(XBlock.entry_point,
                name=settings.FUN_DEFAULT_VIDEO_PLAYER))
    return prefer_xmodules(identifier, entry_points)
Ejemplo n.º 4
0
def prefer_fun_video(identifier, entry_points):
    """
    This function will be affected to XBLOCK_SELECT_FUNCTION which is used to
    filter python package entrypoints each time an xblock is instanciated.
    It replaces `video` xblocks python class by `libcast_xblock`'s one.
    """
    from django.conf import settings
    from xmodule.modulestore import prefer_xmodules
    if identifier == "video":
        import pkg_resources
        from xblock.core import XBlock
        # These entry points are listed in the setup.py of the libcast module
        # Inspired by the XBlock.load_class method
        entry_points = list(
            pkg_resources.iter_entry_points(XBlock.entry_point,
                                            name="libcast_xblock"))
    return prefer_xmodules(identifier, entry_points)