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


Python Post.content_html方法代码示例

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


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

示例1: test_send_wms

# 需要导入模块: from redwind.models import Post [as 别名]
# 或者: from redwind.models.Post import content_html [as 别名]
def test_send_wms(client, mocker):
    getter = mocker.patch('requests.get')
    poster = mocker.patch('requests.post')
    urlopen = mocker.patch('urllib.request.urlopen')

    post = Post('note')
    post.content = 'This note links to [wikipedia](https://en.wikipedia.org/wiki/Webmention)'
    post.content_html = 'This note links to <a href="https://en.wikipedia.org/wiki/Webmention">wikipedia</a>'
    post.path = '2014/11/wm-sender-test'
    db.session.add(post)
    db.session.commit()

    urlopen.return_value = FakeUrlOpen(
        info=FakeUrlMetadata(content_type='text/html', content_length=256))

    getter.return_value = FakeResponse(text="""<!DOCTYPE html>
    <html>
      <link rel="webmention" href="https://en.wikipedia.org/endpoint">
    </html>""")

    wm_sender.do_send_webmentions(post.id)

    getter.assert_called_with('https://en.wikipedia.org/wiki/Webmention')
    poster.assert_called_with('https://en.wikipedia.org/endpoint', data={
        'source': post.permalink,
        'target': 'https://en.wikipedia.org/wiki/Webmention',
    }, headers={
        'content-type': 'application/x-www-form-urlencoded',
        'accept': 'application/json',
    })
开发者ID:thedod,项目名称:redwind,代码行数:32,代码来源:wm_sender_test.py

示例2: source_post

# 需要导入模块: from redwind.models import Post [as 别名]
# 或者: from redwind.models.Post import content_html [as 别名]
def source_post(app, db):
    post = Post('note')
    post.content = 'This note links to [wikipedia](https://en.wikipedia.org/wiki/Webmention)'
    post.content_html = 'This note links to <a href="https://en.wikipedia.org/wiki/Webmention">wikipedia</a>'
    post.path = '2014/11/wm-sender-test'
    db.session.add(post)
    db.session.commit()
    return post
开发者ID:Lancey6,项目名称:redwind,代码行数:10,代码来源:wm_sender_test.py


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