Example #1
0
def load_all(startswith=None):
    if startswith:
        start = startswith
        end = startswith + '~'
        candids = DBResource.bucket.get_index("$key", start, end).results
    else:
        candids = DBResource.updated.filter(StrInt.p_min(), StrInt.p_max())
    return [Resource(r) for r in DBResource.multi_get(candids)]
Example #2
0
def load_all(startswith=None):
    if startswith:
        start = startswith
        end = startswith + '~'
        candids = DBResource.bucket.get_index("$key", start, end).results
    else:
        candids = DBResource.updated.filter(StrInt.p_min(), StrInt.p_max())
    return [Resource(r) for r in DBResource.multi_get(candids)]
Example #3
0
def load_updated(since=None, with_childs=True):
    if since is None:
        startkey = StrInt.p_min()
    else:
        startkey = since
    candids = DBResource.updated.filter(startkey, StrInt.p_max())
    if with_childs:
        candids = DBResource.childs(candids)
    return [Resource(r) for r in DBResource.multi_get(candids)]
Example #4
0
def load_updated(since=None, with_childs=True):
    if since is None:
        startkey = StrInt.p_min()
    else:
        startkey = since
    candids = DBResource.updated.filter(startkey, StrInt.p_max())
    if with_childs:
        candids = DBResource.childs(candids)
    return [Resource(r) for r in DBResource.multi_get(candids)]
Example #5
0
def test_updated_behaviour(rk):
    k1 = next(rk)

    _cmp = StrInt()
    r1 = create_resource(k1, {'name': 'blah'})
    r1.save()
    assert isinstance(r1._riak_object.data['updated'], basestring)
    assert not isinstance(r1.updated, basestring)
    assert r1.updated >= _cmp
    assert k1 in Resource.updated.filter(StrInt.p_min(), StrInt.p_max())
Example #6
0
def test_updated_behaviour(rk):
    k1 = next(rk)

    _cmp = StrInt()
    r1 = create_resource(k1, {'name': 'blah'})
    r1.save()
    assert isinstance(r1._riak_object.data['updated'], basestring)
    assert not isinstance(r1.updated, basestring)
    assert r1.updated >= _cmp
    assert k1 in Resource.updated.filter(StrInt.p_min(), StrInt.p_max())
Example #7
0
def test_updated_only_last(rk):

    for i in range(3):
        r = create_resource(next(rk), {'name': str(i)})
        r.save()
    assert Resource.updated.filter(r.updated, StrInt.p_max()) == [r.key]
Example #8
0
def load_all():
    candids = DBResource.updated.filter(StrInt.p_min(), StrInt.p_max())
    return [Resource(r) for r in DBResource.multi_get(candids)]
Example #9
0
def test_updated_only_last(rk):

    for i in range(3):
        r = create_resource(next(rk), {'name': str(i)})
        r.save()
    assert Resource.updated.filter(r.updated, StrInt.p_max()) == [r.key]
Example #10
0
def load_all():
    candids = DBResource.updated.filter(StrInt.p_min(), StrInt.p_max())
    return [Resource(r) for r in DBResource.multi_get(candids)]