Example #1
0
File: views.py Project: hylhero/h
def annotations_index(request):
    """Do a search for all annotations on anything and return results.

    This will use the default limit, 20 at time of writing, and results
    are ordered most recent first.
    """
    user = get_user(request)
    return search_lib.index(user=user)
Example #2
0
File: views.py Project: ningyifan/h
def annotations_index(request):
    """Do a search for all annotations on anything and return results.

    This will use the default limit, 20 at time of writing, and results
    are ordered most recent first.
    """
    search_normalized_uris = request.feature('search_normalized')

    user = get_user(request)
    results = search_lib.index(user=user,
                               search_normalized_uris=search_normalized_uris)

    return {
        'total': results['total'],
        'rows': [search_lib.render(a) for a in results['rows']],
    }
Example #3
0
File: views.py Project: ningyifan/h
def annotations_index(request):
    """Do a search for all annotations on anything and return results.

    This will use the default limit, 20 at time of writing, and results
    are ordered most recent first.
    """
    search_normalized_uris = request.feature('search_normalized')

    user = get_user(request)
    results = search_lib.index(user=user,
                               search_normalized_uris=search_normalized_uris)

    return {
        'total': results['total'],
        'rows': [search_lib.render(a) for a in results['rows']],
    }
Example #4
0
def test_index_limit_is_20(search_func):
    """index() calls search with "limit": 20."""
    search.index()

    first_call = search_func.call_args_list[0]
    assert first_call[0][0]["limit"] == 20
Example #5
0
def test_index_limit_is_20(search_func):
    """index() calls search with "limit": 20."""
    search.index()

    first_call = search_func.call_args_list[0]
    assert first_call[0][0]["limit"] == 20