本文整理汇总了Python中static_replace.replace_course_urls函数的典型用法代码示例。如果您正苦于以下问题:Python replace_course_urls函数的具体用法?Python replace_course_urls怎么用?Python replace_course_urls使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了replace_course_urls函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multi_replace
def test_multi_replace():
course_source = '"/course/file.png"'
assert replace_static_urls(STATIC_SOURCE, DATA_DIRECTORY) == \
replace_static_urls(replace_static_urls(STATIC_SOURCE, DATA_DIRECTORY), DATA_DIRECTORY)
assert replace_course_urls(course_source, COURSE_KEY) == \
replace_course_urls(replace_course_urls(course_source, COURSE_KEY), COURSE_KEY)
示例2: test_multi_replace
def test_multi_replace():
course_source = '"/course/file.png"'
assert_equals(
replace_static_urls(STATIC_SOURCE, DATA_DIRECTORY),
replace_static_urls(replace_static_urls(STATIC_SOURCE, DATA_DIRECTORY), DATA_DIRECTORY)
)
assert_equals(
replace_course_urls(course_source, course_id),
replace_course_urls(replace_course_urls(course_source, course_id), course_id)
)
示例3: replace_course_urls
def replace_course_urls(course_id, block, view, frag, context): # pylint: disable=unused-argument
"""
Updates the supplied module with a new get_html function that wraps
the old get_html function and substitutes urls of the form /course/...
with urls that are /courses/<course_id>/...
"""
return wrap_fragment(frag, static_replace.replace_course_urls(frag.content, course_id))
示例4: _get_html
def _get_html():
return static_replace.replace_course_urls(get_html(), course_id)