def test_html_list():
    serializer = Serializer('html')
    recipes = [Recipe('recipe' + str(name)) for name in xrange(2)]
    string = ''.join(serializer.list_recipes(recipes))

    assert 'href="recipes/recipe0' in string
    assert 'href="recipes/recipe1' in string
예제 #2
0
def test_html_list():
    serializer = Serializer('html')
    recipes = [Recipe('recipe' + str(name)) for name in xrange(2)]
    string = ''.join(serializer.list_recipes(recipes))

    assert 'href="recipes/recipe0' in string
    assert 'href="recipes/recipe1' in string
def test_html_list():
    serializer = Serializer("html")
    recipes = [Recipe("recipe" + str(name)) for name in range(2)]
    string = "".join(serializer.list_recipes(recipes))

    assert 'href="recipes/recipe0' in string
    assert 'href="recipes/recipe1' in string
예제 #4
0
def list(environ, start_response):
    """
    Get a list of all recipes the current user can read.
    """
    store = environ['tiddlyweb.store']
    recipes = store.list_recipes()
    kept_recipes = []
    for recipe in recipes:
        try:
            recipe = store.get(recipe)
            recipe.policy.allows(environ['tiddlyweb.usersign'], 'read')
            kept_recipes.append(recipe)
        except(UserRequiredError, ForbiddenError):
            # if we got a perm error, just pass
            # and don't add anything to the kept recipes
            pass

    serialize_type, mime_type = web.get_serialize_type(environ)
    serializer = Serializer(serialize_type, environ)

    start_response("200 OK",
            [('Content-Type', mime_type)])

    return [serializer.list_recipes(kept_recipes)]
예제 #5
0
def test_text_list():
    serializer = Serializer('text')
    recipes = [Recipe('recipe' + str(name)) for name in xrange(2)]
    string = ''.join(serializer.list_recipes(recipes))

    assert string == 'recipe0\nrecipe1\n'
def test_text_list():
    serializer = Serializer('text')
    recipes = [Recipe('recipe' + str(name)) for name in xrange(2)]
    string = ''.join(serializer.list_recipes(recipes))

    assert string == 'recipe0\nrecipe1\n'
def test_text_list():
    serializer = Serializer("text")
    recipes = [Recipe("recipe" + str(name)) for name in range(2)]
    string = "".join(serializer.list_recipes(recipes))

    assert string == "recipe0\nrecipe1\n"