本文整理汇总了Python中tiddlyweb.model.tiddler.Tiddler.fields["custom"]方法的典型用法代码示例。如果您正苦于以下问题:Python Tiddler.fields["custom"]方法的具体用法?Python Tiddler.fields["custom"]怎么用?Python Tiddler.fields["custom"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tiddlyweb.model.tiddler.Tiddler
的用法示例。
在下文中一共展示了Tiddler.fields["custom"]方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_html_attribute_escape_with_bag
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import fields["custom"] [as 别名]
def test_html_attribute_escape_with_bag():
tiddler = Tiddler('escape "double" quotes in tiddler field values')
tiddler.bag = 'foo "bar" baz'
tiddler.modifier = 'Chris "sensei" Dent'
tiddler.tags = ["foo", 'xxx "yyy" zzz']
tiddler.fields["custom"] = u"""lorem 'ipsum' dolor "sit" amet"""
tiddler.text = ''
serializer = Serializer('tiddlywebwiki.serialization', environ)
serializer.object = tiddler
string = serializer.to_string()
assert ('title="escape "double" quotes in tiddler field values"'
in string)
assert ('server.title="escape "double" quotes in tiddler '
'field values"' in string)
assert 'bag="foo "bar" baz"' in string
assert 'server.workspace="bags/foo "bar" baz"' in string
assert 'modifier="Chris "sensei" Dent"' in string
assert 'creator="Chris "sensei" Dent"' in string
assert 'tags="foo [[xxx "yyy" zzz]]"' in string
assert '''custom="lorem 'ipsum' dolor "sit" amet"''' in string
# single tiddler's browse link is that tiddler in its bag
assert ('you may still <a href="/bags/foo%20%22bar%22%20baz/tiddlers/'
'escape%20%22double%22%20quotes%20in%20tiddler%20field%20'
'values">browse' in string)
示例2: test_html_attribute_escape
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import fields["custom"] [as 别名]
def test_html_attribute_escape():
tiddler = Tiddler('escape "double" quotes & & in <tiddler> field values')
tiddler.bag = u'foo "bar" baz'
tiddler.modifier = 'Chris "sensei" Dent'
tiddler.tags = ["foo", 'xxx "yyy" zzz']
tiddler.fields["custom"] = u"""lorem 'ipsum' dolor "sit" amet"""
tiddler.text = ''
serializer = Serializer('html')
serializer.object = tiddler
string = serializer.to_string()
assert r'''title="escape "double" quotes & &amp; in <tiddler> field values"''' in string
assert r'''modifier="Chris "sensei" Dent"''' in string
assert r'''tags="foo [[xxx "yyy" zzz]]"''' in string
assert r'''custom="lorem 'ipsum' dolor "sit" amet"''' in string
示例3: test_html_attribute_escape_with_recipe
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import fields["custom"] [as 别名]
def test_html_attribute_escape_with_recipe():
tiddler = Tiddler('escape "double" quotes in tiddler field values')
tiddler.bag = 'foo "bar" baz'
tiddler.recipe = 'baz "bar" foo'
tiddler.modifier = 'Chris "sensei" Dent'
tiddler.tags = ["foo", 'xxx "yyy" zzz']
tiddler.fields["custom"] = u"""lorem 'ipsum' dolor "sit" amet"""
tiddler.text = ''
serializer = Serializer('tiddlywebwiki.serialization', environ)
serializer.object = tiddler
string = serializer.to_string()
assert r'''title="escape "double" quotes in tiddler field values"''' in string
assert r'''server.title="escape "double" quotes in tiddler field values"''' in string
assert r'''bag="foo "bar" baz"''' in string
assert r'''recipe="baz "bar" foo"''' in string
assert r'''server.workspace="bags/foo "bar" baz"''' in string
assert r'''modifier="Chris "sensei" Dent"''' in string
assert r'''creator="Chris "sensei" Dent"''' in string
assert r'''tags="foo [[xxx "yyy" zzz]]"''' in string
assert r'''custom="lorem 'ipsum' dolor "sit" amet"''' in string
assert r'''you may still <a href="http://0.0.0.0:8080/recipes/baz%20%22bar%22%20foo/tiddlers">browse''' in string