本文整理匯總了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',
})
示例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