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


Python Tiddler.fields["custom"]方法代码示例

本文整理汇总了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)
开发者ID:tiddlyweb,项目名称:tiddlywebwiki,代码行数:27,代码来源:test_serialize_tiddler.py

示例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 & &amp; 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 &quot;double&quot; quotes &amp; &amp;amp; in &lt;tiddler&gt; field values"''' in string
    assert r'''modifier="Chris &quot;sensei&quot; Dent"''' in string
    assert r'''tags="foo [[xxx &quot;yyy&quot; zzz]]"''' in string
    assert r'''custom="lorem 'ipsum' dolor &quot;sit&quot; amet"''' in string
开发者ID:FND,项目名称:tiddlyweb,代码行数:17,代码来源:test_serialize_tiddler.py

示例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 &quot;double&quot; quotes in tiddler field values"''' in string
    assert r'''server.title="escape &quot;double&quot; quotes in tiddler field values"''' in string
    assert r'''bag="foo &quot;bar&quot; baz"''' in string
    assert r'''recipe="baz &quot;bar&quot; foo"''' in string
    assert r'''server.workspace="bags/foo &quot;bar&quot; baz"''' in string
    assert r'''modifier="Chris &quot;sensei&quot; Dent"''' in string
    assert r'''creator="Chris &quot;sensei&quot; Dent"''' in string
    assert r'''tags="foo [[xxx &quot;yyy&quot; zzz]]"''' in string
    assert r'''custom="lorem 'ipsum' dolor &quot;sit&quot; 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
开发者ID:FND,项目名称:tiddlywebwiki,代码行数:24,代码来源:test_serialize_tiddler.py


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