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


Python Bag.store方法代码示例

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


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

示例1: test_filter_bag_by_filter

# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import store [as 别名]
def test_filter_bag_by_filter():
    """
    Confirm a bag will properly filter.
    """
    bagfour = Bag('bagfour')
    store.put(bagfour)
    bagfour.store = store
    for tiddler in tiddlers:
        tiddler.bag = 'bagfour'
        store.put(tiddler)

    filtered_tiddlers = list(control._filter_tiddlers_from_bag(bagfour,
        'select=title:TiddlerOne', environ=environ))
    assert len(filtered_tiddlers) == 1
    assert filtered_tiddlers[0].title == 'TiddlerOne'

    filtered_tiddlers = list(control._filter_tiddlers_from_bag(bagfour,
        'select=tag:tagone', environ=environ))
    assert len(filtered_tiddlers) == 2

    filters, thing = parse_for_filters(
            'select=tag:tagone;select=title:TiddlerThree', environ=environ)
    filtered_tiddlers = list(control._filter_tiddlers_from_bag(bagfour,
        filters, environ=environ))
    assert len(filtered_tiddlers) == 1
    assert filtered_tiddlers[0].title == 'TiddlerThree'
开发者ID:24king,项目名称:tiddlyweb,代码行数:28,代码来源:test_bag_filtering.py

示例2: get_tiddlers_from_recipe

# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import store [as 别名]
def get_tiddlers_from_recipe(recipe, environ=None):
    """
    Return the list of tiddlers that result from processing the recipe.

    This list of tiddlers is unique by title with tiddlers later in the
    recipe taking precedence over those earlier in the recipe.

    The tiddlers returned are empty objects.
    """
    template = recipe_template(environ)
    store = recipe.store
    uniquifier = {}
    for bag, filter_string in recipe.get_recipe(template):
        if isinstance(bag, basestring):
            bag = Bag(name=bag)
        bag.store = store
        for tiddler in _filter_tiddlers_from_bag(bag, filter_string, environ=environ):
            uniquifier[tiddler.title] = tiddler
    return uniquifier.values()
开发者ID:rdrake98,项目名称:tiddlyweb,代码行数:21,代码来源:control.py


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