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


Python Recipe.get_recipe方法代码示例

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


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

示例1: test_get_recipe

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_get_recipe():
    recipe = Recipe('templated')
    recipe.set_recipe([
        ('common', 'select=topic:{{ id:default }}'),
        ('{{ user }}', ''),
        ('system', '')
    ])

    stuff = recipe.get_recipe()
    assert stuff[0][1] == 'select=topic:{{ id:default }}'
    assert stuff[1][0] == '{{ user }}'

    filled = recipe.get_recipe(recipe_template(environ))
    assert filled[0][1] == 'select=topic:default'
    assert filled[1][0] == 'JohnSmith'
开发者ID:24king,项目名称:tiddlyweb,代码行数:17,代码来源:test_recipe_template.py

示例2: test_get_recipe_list_templated_bag

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_get_recipe_list_templated_bag():
    recipe = Recipe('tr')
    recipe.set_recipe([
        ('{{ user }}', '')
        ])
    list = recipe.get_recipe({'user': 'testuser'})
    assert list[0][0] == 'testuser'
开发者ID:JazzDeben,项目名称:tiddlyweb-xmobile,代码行数:9,代码来源:test_recipe.py

示例3: test_get_recipe_list_templated_filter2

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_get_recipe_list_templated_filter2():
    recipe = Recipe('tr')
    recipe.set_recipe([
        ('system', 'modifier={{ user }};creator={{ user }}')
        ])
    list = recipe.get_recipe({'user': 'testuser'})
    assert list[0][1] == 'modifier=testuser;creator=testuser'
开发者ID:JazzDeben,项目名称:tiddlyweb-xmobile,代码行数:9,代码来源:test_recipe.py

示例4: test_get_recipe_list_templated_bag_filter_defaulted_bag

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_get_recipe_list_templated_bag_filter_defaulted_bag():
    recipe = Recipe('tr')
    recipe.set_recipe([
        ('{{ bagname:common }}', 'modifier={{ user }}')
        ])
    list = recipe.get_recipe({'user': 'testuser'})
    assert list[0][1] == 'modifier=testuser'
    assert list[0][0] == 'common'
开发者ID:JazzDeben,项目名称:tiddlyweb-xmobile,代码行数:10,代码来源:test_recipe.py

示例5: test_get_recipe_list_templated_bag_filter

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_get_recipe_list_templated_bag_filter():
    recipe = Recipe('tr')
    recipe.set_recipe([
        ('{{ bagname }}', 'modifier={{ user }}')
        ])
    list = recipe.get_recipe({'user': 'testuser', 'bagname': 'foobar'})
    assert list[0][1] == 'modifier=testuser'
    assert list[0][0] == 'foobar'
开发者ID:JazzDeben,项目名称:tiddlyweb-xmobile,代码行数:10,代码来源:test_recipe.py

示例6: test_recipe_get

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_recipe_get():
    """
    get a recipe from disk and confirm it has proper form.
    """

    stored_recipe = Recipe('testrecipe')
    stored_recipe = store.get(stored_recipe)

    assert stored_recipe.get_recipe() == recipe_list_string
开发者ID:tiddlyweb,项目名称:tiddlyweb,代码行数:11,代码来源:test_store_recipe.py

示例7: test_recipe_weird_bag

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_recipe_weird_bag():
    recipe = Recipe("weirdbags")
    recipe.set_recipe([("foo/bar", ""), ("zam/boom", "")])
    store.put(recipe)

    new_recipe = Recipe("weirdbags")
    new_recipe = store.get(new_recipe)
    bags = [bag for bag, filter in new_recipe.get_recipe()]
    assert bags == ["foo/bar", "zam/boom"]
开发者ID:gravesmedical,项目名称:tiddlyweb,代码行数:11,代码来源:test_store_recipe.py

示例8: test_recipe

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_recipe():
    set_stdin(RECIPE_STRING)
    handle(['', u'recipe', u'recipe1'])

    the_recipe = Recipe('recipe1')
    the_recipe = store.get(the_recipe)

    assert the_recipe.name == 'recipe1'
    assert u'bag1' in the_recipe.get_recipe()[0]
    assert u'bag2' in the_recipe.get_recipe()[1]
开发者ID:JazzDeben,项目名称:tiddlyweb-xmobile,代码行数:12,代码来源:test_commands.py

示例9: test_simple_recipe

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_simple_recipe():
    recipe = Recipe('other')
    recipe.set_recipe([('bagbuzz', '')])
    recipe.policy.manage = ['a']
    recipe.policy.read = ['b']
    recipe.policy.create = ['c']
    recipe.policy.delete = ['d']
    recipe.policy.owner = 'e'
    serializer = Serializer('text')
    serializer.object = recipe
    string = serializer.to_string()

    new_recipe = Recipe('other')
    serializer.object = new_recipe
    serializer.from_string(string)

    assert recipe.get_recipe() == new_recipe.get_recipe()

    recipe = Recipe('other')
    recipe.set_recipe([('bagboom', '')])
    assert recipe != new_recipe, 'modified recipe not equal new_recipe'
开发者ID:JazzDeben,项目名称:tiddlyweb-xmobile,代码行数:23,代码来源:test_serialize_recipe.py

示例10: test_simple_recipe

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_simple_recipe():
    recipe = Recipe("other")
    recipe.set_recipe([("bagbuzz", "")])
    recipe.policy.manage = ["a"]
    recipe.policy.read = ["b"]
    recipe.policy.create = ["c"]
    recipe.policy.delete = ["d"]
    recipe.policy.owner = "e"
    serializer = Serializer("text")
    serializer.object = recipe
    string = serializer.to_string()

    new_recipe = Recipe("other")
    serializer.object = new_recipe
    serializer.from_string(string)

    assert recipe.get_recipe() == new_recipe.get_recipe()

    recipe = Recipe("other")
    recipe.set_recipe([("bagboom", "")])
    assert recipe != new_recipe
开发者ID:gravesmedical,项目名称:tiddlyweb,代码行数:23,代码来源:test_serialize_recipe.py

示例11: test_recipe_weird_bag

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_recipe_weird_bag():
    recipe = Recipe('weirdbags')
    recipe.set_recipe([
        ('foo/bar', ''),
        ('zam/boom', ''),
        ])
    store.put(recipe)

    new_recipe = Recipe('weirdbags')
    new_recipe = store.get(new_recipe)
    bags = [bag for bag,filter in new_recipe.get_recipe()]
    assert bags == ['foo/bar', 'zam/boom']
开发者ID:chancejiang,项目名称:tiddlyweb,代码行数:14,代码来源:test_store_recipe.py

示例12: test_put_unicode_recipe

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_put_unicode_recipe():
    http = httplib2.Http()
    encoded_recipe_name = encoded_name
    recipe_name = name
    encoded_bag_name = encoded_name
    bag_name = name

    recipe_list = [[bag_name, '[tag[%s]]' % name]]
    json_recipe_list = simplejson.dumps(dict(recipe=recipe_list))
    response, content = http.request('http://our_test_domain:8001/recipes/%s' % encoded_recipe_name,
            method='PUT', body=json_recipe_list, headers={'Content-Type':'application/json'})
    assert response['status'] == '204'

    recipe = Recipe(recipe_name)
    recipe = store.get(recipe)
    assert recipe.get_recipe() == recipe_list
    assert recipe.name == recipe_name
开发者ID:djswagerman,项目名称:tiddlyweb,代码行数:19,代码来源:test_web_unicode.py

示例13: test_roundtrip_unicode_recipe

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_roundtrip_unicode_recipe():
    http = httplib2.Http()
    encoded_recipe_name = '%E3%81%86%E3%81%8F%E3%81%99'
    recipe_name = unicode(urllib.unquote(encoded_recipe_name), 'utf-8')
    assert type(recipe_name) == unicode
    recipe_list = [[recipe_name, '']]
    body = simplejson.dumps(dict(desc='',recipe=recipe_list))
    response, content = http.request('http://our_test_domain:8001/recipes/%s' % encoded_recipe_name,
            method='PUT', body=body.encode('utf-8'), headers={'Content-Type': 'application/json'})
    assert response['status'] == '204'

    recipe = Recipe(recipe_name)
    recipe = store.get(recipe)
    assert recipe.get_recipe() == recipe_list

    response, content = http.request('http://our_test_domain:8001/recipes/%s.json' % encoded_recipe_name,
            method='GET')
    assert response['status'] == '200'
    assert simplejson.loads(content)['recipe'] == recipe_list
开发者ID:JazzDeben,项目名称:tiddlyweb-xmobile,代码行数:21,代码来源:test_web_recipe.py

示例14: test_recipe_with_special

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [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

示例15: test_put_unicode_recipe

# 需要导入模块: from tiddlyweb.model.recipe import Recipe [as 别名]
# 或者: from tiddlyweb.model.recipe.Recipe import get_recipe [as 别名]
def test_put_unicode_recipe():
    http = httplib2.Http()
    encoded_recipe_name = encoded_name
    recipe_name = name
    encoded_bag_name = encoded_name
    bag_name = name

    recipe_list = [[bag_name, "[tag[%s]]" % name]]
    json_recipe_list = simplejson.dumps(dict(recipe=recipe_list))
    response, content = http.request(
        "http://our_test_domain:8001/recipes/%s" % encoded_recipe_name,
        method="PUT",
        body=json_recipe_list,
        headers={"Content-Type": "application/json"},
    )
    assert response["status"] == "204"

    recipe = Recipe(recipe_name)
    recipe = store.get(recipe)
    assert recipe.get_recipe() == recipe_list
    assert recipe.name == recipe_name
开发者ID:angeluseve,项目名称:tiddlyweb,代码行数:23,代码来源:test_web_unicode.py


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