当前位置: 首页>>代码示例>>Python>>正文


Python CoursewareSearchIndexer.indexing_is_enabled方法代码示例

本文整理汇总了Python中contentstore.courseware_index.CoursewareSearchIndexer.indexing_is_enabled方法的典型用法代码示例。如果您正苦于以下问题:Python CoursewareSearchIndexer.indexing_is_enabled方法的具体用法?Python CoursewareSearchIndexer.indexing_is_enabled怎么用?Python CoursewareSearchIndexer.indexing_is_enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在contentstore.courseware_index.CoursewareSearchIndexer的用法示例。


在下文中一共展示了CoursewareSearchIndexer.indexing_is_enabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: listen_for_course_publish

# 需要导入模块: from contentstore.courseware_index import CoursewareSearchIndexer [as 别名]
# 或者: from contentstore.courseware_index.CoursewareSearchIndexer import indexing_is_enabled [as 别名]
def listen_for_course_publish(sender, course_key, **kwargs):  # pylint: disable=unused-argument
    """
    Receives publishing signal and performs publishing related workflows, such as
    registering proctored exams, building up credit requirements, and performing
    search indexing
    """

    # first is to registered exams, the credit subsystem will assume that
    # all proctored exams have already been registered, so we have to do that first
    try:
        register_special_exams(course_key)
    # pylint: disable=broad-except
    except Exception as exception:
        log.exception(exception)

    # then call into the credit subsystem (in /openedx/djangoapps/credit)
    # to perform any 'on_publish' workflow
    on_course_publish(course_key)

    # Finally call into the course search subsystem
    # to kick off an indexing action
    if CoursewareSearchIndexer.indexing_is_enabled():
        # import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
        from contentstore.tasks import update_search_index

        update_search_index.delay(unicode(course_key), datetime.now(UTC).isoformat())
开发者ID:Lektorium-LLC,项目名称:edx-platform,代码行数:28,代码来源:handlers.py

示例2: listen_for_course_publish

# 需要导入模块: from contentstore.courseware_index import CoursewareSearchIndexer [as 别名]
# 或者: from contentstore.courseware_index.CoursewareSearchIndexer import indexing_is_enabled [as 别名]
def listen_for_course_publish(sender, course_key, **kwargs):  # pylint: disable=unused-argument
    """
    Receives signal and kicks off celery task to update search index
    """
    # import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
    from .tasks import update_search_index
    if CoursewareSearchIndexer.indexing_is_enabled():
        update_search_index.delay(unicode(course_key), datetime.now(UTC).isoformat())
开发者ID:189140879,项目名称:edx-platform,代码行数:10,代码来源:signals.py


注:本文中的contentstore.courseware_index.CoursewareSearchIndexer.indexing_is_enabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。