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


Python Tiddler.fields[u'house']方法代码示例

本文整理汇总了Python中tiddlyweb.model.tiddler.Tiddler.fields[u'house']方法的典型用法代码示例。如果您正苦于以下问题:Python Tiddler.fields[u'house']方法的具体用法?Python Tiddler.fields[u'house']怎么用?Python Tiddler.fields[u'house']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tiddlyweb.model.tiddler.Tiddler的用法示例。


在下文中一共展示了Tiddler.fields[u'house']方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_search_right_revision

# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import fields[u'house'] [as 别名]
def test_search_right_revision():
    tiddler = Tiddler(u'revised', u'bag1')
    tiddler.text = u'alpha'
    tiddler.fields[u'house'] = u'cottage'
    store.put(tiddler)
    tiddler = Tiddler(u'revised', u'bag1')
    tiddler.text = u'beta'
    tiddler.fields[u'house'] = u'mansion'
    store.put(tiddler)
    tiddler = Tiddler(u'revised', u'bag1')
    tiddler.text = u'gamma'
    tiddler.fields[u'house'] = u'barn'
    store.put(tiddler)
    tiddler = Tiddler(u'revised', u'bag1')
    tiddler.text = u'delta'
    tiddler.fields[u'house'] = u'bungalow'
    store.put(tiddler)
    tiddler = Tiddler(u'revised', u'bag1')
    tiddler.text = u'epsilon'
    tiddler.fields[u'house'] = u'treehouse'
    store.put(tiddler)

    tiddlers = list(store.search('beta'))
    assert len(tiddlers) == 0

    tiddlers = list(store.search('epsilon'))
    assert len(tiddlers) == 1
    tiddler = store.get(Tiddler(tiddlers[0].title, tiddlers[0].bag))
    assert tiddler.title == 'revised'
    assert tiddler.bag == 'bag1'
    assert tiddler.fields['house'] == 'treehouse'

    kwords = {'bag': u'bag1', 'house': u'barn'}
    tiddlers = list(index_query(environ, **kwords))

    assert len(tiddlers) == 0

    kwords = {'bag': u'bag1', 'house': u'treehouse'}
    tiddlers = list(index_query(environ, **kwords))

    assert tiddlers[0].title == 'revised'
    assert tiddlers[0].bag == 'bag1'
    assert tiddlers[0].fields['house'] == 'treehouse'

    kwords = {'bag': u'bag1', 'tag': u'orange'}
    tiddlers = list(index_query(environ, **kwords))

    assert len(tiddlers) == 1

    kwords = {'bag': u'bag1', 'tag': u'rang'}
    tiddlers = list(index_query(environ, **kwords))

    assert len(tiddlers) == 0
开发者ID:tiddlyweb,项目名称:tiddlywebplugins.mysql,代码行数:55,代码来源:test_search.py

示例2: test_search_follow_syntax

# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import fields[u'house'] [as 别名]
def test_search_follow_syntax():
    QUERY = u'ftitle:GettingStarted (bag:cdent_public OR bag:fnd_public)'

    store.put(Bag(u'fnd_public'))
    store.put(Bag(u'cdent_public'))
    tiddler = Tiddler(u'GettingStarted', u'fnd_public')
    tiddler.text = u'fnd starts'
    tiddler.fields[u'house'] = u'treehouse'
    tiddler.fields[u'car'] = u'porsche'
    store.put(tiddler)
    tiddler = Tiddler(u'GettingStarted', u'cdent_public')
    tiddler.text = u'cdent starts'
    tiddler.fields[u'left-hand'] = u'well dirty'
    store.put(tiddler)
    tiddler = Tiddler(u'other', u'cdent_public')
    tiddler.text = u'cdent starts'
    store.put(tiddler)

    tiddlers = list(store.search(u'starts'))
    assert len(tiddlers) == 3

    tiddlers = list(store.search(QUERY))
    assert len(tiddlers) == 2

    tiddlers = list(store.search(u'cdent starts'))
    assert len(tiddlers) == 2

    tiddlers = list(store.search(u'fnd starts'))
    assert len(tiddlers) == 1

    tiddler = list(store.search(u'left-hand:"well dirty"'))
    assert len(tiddlers) == 1
开发者ID:tiddlyweb,项目名称:tiddlywebplugins.mysql,代码行数:34,代码来源:test_search.py

示例3: test_simple_store

# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import fields[u'house'] [as 别名]
def test_simple_store():
    bag = Bag(u'bag1')
    store.put(bag)
    tiddler = Tiddler(u'tiddler1', u'bag1')
    tiddler.text = u'oh hello i chrisdent have nothing to say here you know'
    tiddler.tags = [u'apple', u'orange', u'pear']
    tiddler.fields[u'house'] = u'cottage'
    store.put(tiddler)

    retrieved = Tiddler(u'tiddler1', u'bag1')
    retrieved = store.get(retrieved)

    assert retrieved.text == tiddler.text
开发者ID:tiddlyweb,项目名称:tiddlywebplugins.mysql,代码行数:15,代码来源:test_search.py


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