本文整理匯總了Python中mkt.translations.models.PurifiedTranslation.__html__方法的典型用法代碼示例。如果您正苦於以下問題:Python PurifiedTranslation.__html__方法的具體用法?Python PurifiedTranslation.__html__怎麽用?Python PurifiedTranslation.__html__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mkt.translations.models.PurifiedTranslation
的用法示例。
在下文中一共展示了PurifiedTranslation.__html__方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_external_text_link
# 需要導入模塊: from mkt.translations.models import PurifiedTranslation [as 別名]
# 或者: from mkt.translations.models.PurifiedTranslation import __html__ [as 別名]
def test_external_text_link(self, get_outgoing_url_mock):
get_outgoing_url_mock.return_value = 'http://external.url'
s = u'<b>markup</b> http://example.com'
x = PurifiedTranslation(localized_string=s)
eq_(x.__html__(),
u'<b>markup</b> <a rel="nofollow" '
u'href="http://external.url">http://example.com</a>')
示例2: test_internal_link
# 需要導入模塊: from mkt.translations.models import PurifiedTranslation [as 別名]
# 或者: from mkt.translations.models.PurifiedTranslation import __html__ [as 別名]
def test_internal_link(self):
s = u'<b>markup</b> <a href="http://addons.mozilla.org/foo">bar</a>'
x = PurifiedTranslation(localized_string=s)
eq_(x.__html__(),
u'<b>markup</b> <a href="http://addons.mozilla.org/foo">bar</a>')
示例3: test_forbidden_tags
# 需要導入模塊: from mkt.translations.models import PurifiedTranslation [as 別名]
# 或者: from mkt.translations.models.PurifiedTranslation import __html__ [as 別名]
def test_forbidden_tags(self):
s = u'<script>some naughty xss</script>'
x = PurifiedTranslation(localized_string=s)
eq_(x.__html__(), '<script>some naughty xss</script>')
示例4: test_allowed_tags
# 需要導入模塊: from mkt.translations.models import PurifiedTranslation [as 別名]
# 或者: from mkt.translations.models.PurifiedTranslation import __html__ [as 別名]
def test_allowed_tags(self):
s = u'<b>bold text</b> or <code>code</code>'
x = PurifiedTranslation(localized_string=s)
eq_(x.__html__(), u'<b>bold text</b> or <code>code</code>')
示例5: test_raw_text
# 需要導入模塊: from mkt.translations.models import PurifiedTranslation [as 別名]
# 或者: from mkt.translations.models.PurifiedTranslation import __html__ [as 別名]
def test_raw_text(self):
s = u' This is some text '
x = PurifiedTranslation(localized_string=s)
eq_(x.__html__(), 'This is some text')
示例6: test_external_text_link
# 需要導入模塊: from mkt.translations.models import PurifiedTranslation [as 別名]
# 或者: from mkt.translations.models.PurifiedTranslation import __html__ [as 別名]
def test_external_text_link(self):
s = u'<b>markup</b> http://example.com'
x = PurifiedTranslation(localized_string=s)
eq_(x.__html__(),
u'<b>markup</b> '
u'<a href="http://example.com">http://example.com</a>')