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


Python Recipe.store方法代码示例

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


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

示例1: test_in_a_recipe

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import store [as 别名]
def test_in_a_recipe():
    from tiddlyweb.config import config
    store = get_store(config)
    bag = Bag('hi')
    store.put(bag)
    tiddler = Tiddler('thing1', 'hi')
    tiddler.tags = ['research']
    store.put(tiddler)
    tiddler = Tiddler('thing2', 'hi')
    store.put(tiddler)

    recipe1 = Recipe('oi')
    recipe1.set_recipe([('hi', 'mselect=tag:research')])
    recipe1.store = store
    recipe2 = Recipe('coi')
    recipe2.set_recipe([('hi', 'select=tag:research')])
    recipe2.store = store
    recipe3 = Recipe('boi')
    recipe3.set_recipe([('hi', '')])
    recipe3.store = store
    environ = {'tiddlyweb.store': store}
    tiddlers = list(control.get_tiddlers_from_recipe(recipe1, environ))
    assert len(tiddlers) == 1
    tiddlers = list(control.get_tiddlers_from_recipe(recipe2, environ))
    assert len(tiddlers) == 1
    tiddlers = list(control.get_tiddlers_from_recipe(recipe3, environ))
    assert len(tiddlers) == 2
开发者ID:tiddlyweb,项目名称:tiddlywebplugins.mselect,代码行数:29,代码来源:test_union_filter.py

示例2: test_index_query_in_recipe

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import store [as 别名]
def test_index_query_in_recipe():
    config['indexer'] = 'test.indexernot'

    bag = Bag('noop')
    store.put(bag)
    tiddler = Tiddler('dwell', 'noop')
    store.put(tiddler)

    recipe = Recipe('coolio')
    recipe.set_recipe([('noop', u''), ('fwoop', u'')])
    recipe.store = store

    tiddler = Tiddler('swell')
    py.test.raises(ImportError,
            'determine_bag_from_recipe(recipe, tiddler, environ)')

    config['indexer'] = 'test.indexer'
    bag = determine_bag_from_recipe(recipe, tiddler, environ)
    assert bag.name == 'fwoop'

    tiddler = Tiddler('dwell')
    bag = determine_bag_from_recipe(recipe, tiddler, environ)
    assert bag.name == 'noop'

    tiddler = Tiddler('carnaby')  # nowhere
    py.test.raises(NoBagError,
            'determine_bag_from_recipe(recipe, tiddler, environ)')
开发者ID:24king,项目名称:tiddlyweb,代码行数:29,代码来源:test_control.py

示例3: test_bag_object_in_recipe

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import store [as 别名]
def test_bag_object_in_recipe():
    bag = Bag('fwoop')
    store.put(bag)
    tiddler = Tiddler('swell', 'fwoop')
    tiddler.text = 'hi'
    store.put(tiddler)

    recipe = Recipe('heyo')
    recipe.set_recipe([(bag, '')])
    recipe.store = store
    tiddlers = list(get_tiddlers_from_recipe(recipe, environ))
    assert len(tiddlers) == 1
    assert tiddlers[0].title == 'swell'
    assert tiddlers[0].bag == 'fwoop'
开发者ID:24king,项目名称:tiddlyweb,代码行数:16,代码来源:test_control.py

示例4: user_page

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import store [as 别名]
def user_page(environ, start_response): 
    print(environ)
    name = environ['wsgiorg.routing_args'][1].get('name', 'default')
    recipe = Recipe('tmp')
    recipe.set_recipe([
        [name, '']
   	     ]) 
    # establish the store on the recipe so that get_tiddlers_from_recipe
    # will load the bags and their tiddler lists from the store
    recipe.store = environ['tiddlyweb.store']
    tiddlers = control.get_tiddlers_from_recipe(recipe, environ)
    bag = Bag('tmp', tmpbag=True)
    bag.add_tiddlers(tiddlers)
    return send_tiddlers(environ, start_response, bag)
开发者ID:simonmcmanus,项目名称:goodtube,代码行数:16,代码来源:users.py

示例5: test_recipe_with_special

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import store [as 别名]
def test_recipe_with_special():
    recipe = Recipe('special')
    recipe.set_recipe([
        ('normal', ''),
        ('Xnine', '')])
    recipe.store = store

    tiddlers = list(get_tiddlers_from_recipe(recipe, environ))

    assert len(tiddlers) == 4
    assert 'thing' in [tiddler.title for tiddler in tiddlers]
    assert 'alpha' in [tiddler.title for tiddler in tiddlers]
    assert 'beta' in [tiddler.title for tiddler in tiddlers]
    assert 'gamma' in [tiddler.title for tiddler in tiddlers]

    # roundtrip the recipes with a special
    store.put(recipe)
    recipe2 = store.get(Recipe('special'))

    assert recipe.get_recipe() == recipe2.get_recipe()
开发者ID:funkyeah,项目名称:tiddlyweb,代码行数:22,代码来源:test_specialbag.py

示例6: test_list_recipe_tiddlers

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import store [as 别名]
def test_list_recipe_tiddlers():
    bag = Bag('alpha')
    STORE.put(bag)

    recipe = Recipe('omega')
    recipe.set_recipe([('alpha', '')])
    recipe.store = STORE
    STORE.put(recipe)

    for title in ['Foo', 'Bar', 'Baz']:
        tiddler = Tiddler(title, bag.name)
        STORE.put(tiddler)

    initialize_app(STORE.environ['tiddlyweb.config'])

    http = httplib2.Http()
    response, content = (http.
            request('http://example.org:8001/recipes/omega/tiddlers.json',
                    method='GET'))

    for tiddler in json.loads(content):
        assert tiddler["recipe"] == recipe.name
开发者ID:FND,项目名称:tiddlywebplugins.gitstore,代码行数:24,代码来源:test_listing.py

示例7: create_dynamic_recipe

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import store [as 别名]
 def create_dynamic_recipe(environ,recipeDefinition):
     recipe = Recipe('myRecipe')        
     recipe.set_recipe(recipeDefinition)
     recipe.store = environ['tiddlyweb.store']
     return recipe
开发者ID:FND,项目名称:tiddlywiki-svn-mirror,代码行数:7,代码来源:tiddlywebeditor_plus.py


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