コード例 #1
0
ファイル: views.py プロジェクト: pbugni/pheme.webAPI
def find_documents(context, request):
    """Present contents or metadata for multiple matching document(s)

    :query param query: JSONified dictionary defining search criteria
    :query param limit: optional restriction to size of result set

    If only a single document is found to match search criteria, the
    document contents will be returned.

    If multiple matches are found, a list of metadata will be
    returned.

    No match results in an empty result.

    """
    query = request.params.get('query')
    criteria = decode_isofomat_datetime(json.loads(query))
    limit = int(request.params.get('limit', 0))  # limit of 0 == no limit
    return context.search(criteria, limit)
コード例 #2
0
def test_isoformat_decode_nothing():
    # should get back dict passed if no isoformats are present
    d = {1: 'one', 'two': 2, 'nested': {'a': 'eh'}, 'tup': (1, 2, 3)}
    e = decode_isofomat_datetime(d)
    assert (d == e)
コード例 #3
0
def test_isoformat_decode():
    d = {'now': datetime.now().isoformat()}
    e = decode_isofomat_datetime(d)
    assert (d == e)
コード例 #4
0
ファイル: test_format.py プロジェクト: pbugni/pheme.util
def test_isoformat_decode_nothing():
    # should get back dict passed if no isoformats are present
    d = {1: 'one', 'two': 2, 'nested': {'a': 'eh'}, 'tup': (1, 2, 3)}
    e = decode_isofomat_datetime(d)
    assert(d == e)
コード例 #5
0
ファイル: test_format.py プロジェクト: pbugni/pheme.util
def test_isoformat_decode():
    d = {'now': datetime.now().isoformat()}
    e = decode_isofomat_datetime(d)
    assert(d == e)