本文整理汇总了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())
示例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())