本文整理汇总了Python中tiddlyweb.model.tiddler.Tiddler.fields[title]方法的典型用法代码示例。如果您正苦于以下问题:Python Tiddler.fields[title]方法的具体用法?Python Tiddler.fields[title]怎么用?Python Tiddler.fields[title]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tiddlyweb.model.tiddler.Tiddler
的用法示例。
在下文中一共展示了Tiddler.fields[title]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_emoji_title
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import fields[title] [as 别名]
def test_emoji_title():
"""
We expect this to fail because we're using a) old mysql
b) without the utf8mb4 encoding type.
See: https://github.com/TiddlySpace/tiddlyspace/issues/1033
The fix is to use mysql 5.5 or beyond.
"""
# emoji smiley of some sort
title = '\xF0\x9F\x98\x97'.decode('utf-8')
store.put(Bag(title))
tiddler = Tiddler(title, title)
tiddler.text = u'some stuff and zomg %s' % title
tiddler.tags = [title]
tiddler.fields[title] = title
store.put(tiddler)
tiddler2 = store.get(Tiddler(title, title))
assert tiddler2.title == title
assert tiddler2.text == tiddler.text
assert tiddler2.tags == tiddler.tags
assert tiddler2.tags[0] == title
assert tiddler2.fields[title] == tiddler.fields[title]
assert tiddler2.fields[title] == title
示例2: test_emoji_title
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import fields[title] [as 别名]
def test_emoji_title():
# emoji smiley of some sort
title = "\xF0\x9F\x98\x97".decode("utf-8")
store.put(Bag(title))
tiddler = Tiddler(title, title)
tiddler.text = u"some stuff and zomg %s" % title
tiddler.tags = [title]
tiddler.fields[title] = title
store.put(tiddler)
tiddler2 = store.get(Tiddler(title, title))
assert tiddler2.title == title
assert tiddler2.text == tiddler.text
assert tiddler2.tags == tiddler.tags
assert tiddler2.tags[0] == title
assert tiddler2.fields[title] == tiddler.fields[title]
assert tiddler2.fields[title] == title