Exemple #1
0
def del_by_obj_type(obj, type):
    """deletes any and all entities with given obj_id and type"""
    query = Relation.gql("WHERE obj_id = :1 AND type = :2", obj, type)
    for record in query:
        rpc = urlfetch.create_rpc()
        urlfetch.make_fetch_call(rpc, cmdurl + "/relation/type?%s/%s/null" % (type, obj), method="DELETE", headers={'sharedpass': sharedpass})
        record.delete()
Exemple #2
0
def delete(subj, type, obj):
    """deletes any and all entities with given subj_id, type, and obj_id"""
    query = Relation.gql("WHERE subj_id =  :1 AND type = :2 and obj_id = :3", subj, type, obj)
    for record in query:
        rpc = urlfetch.create_rpc()
        urlfetch.make_fetch_call(rpc, cmdurl + '/relation/all?%s/%s/%s' % (type, obj, subj), method="DELETE", headers={'sharedpass': sharedpass})
        record.delete()
Exemple #3
0
def del_by_obj(obj):
    """deletes any and all entities with given obj_id"""
    query = Relation.gql("WHERE obj_id = :1", obj)
    for record in query:
        rpc = urlfetch.create_rpc()
        urlfetch.make_fetch_call(rpc, cmdurl + "/relation/obj?null/%s/null" % (obj), method="DELETE", headers={'sharedpass': sharedpass})
        record.delete()
Exemple #4
0
def create_unique(subj, type, obj):
    """creates relation with given subj_id, type, and obj_id, if not already present"""
    query = Relation.gql("WHERE subj_id =  :1 AND type = :2 and obj_id = :3", subj, type, obj)
    if query.count() == 0:
        rpc = urlfetch.create_rpc()
        urlfetch.make_fetch_call(rpc, cmdurl + '/relation/?%s/%s/%s' % (type, obj, subj), method="PUT", headers={'sharedpass': sharedpass})
        record = Relation(subj_id = subj, type = type, obj_id = obj)
        record.put()
Exemple #5
0
def del_by_obj(obj):
    """deletes any and all entities with given obj_id"""
    query = Relation.gql("WHERE obj_id = :1", obj)
    for record in query:
        rpc = urlfetch.create_rpc()
        urlfetch.make_fetch_call(rpc,
                                 cmdurl + "/relation/obj?null/%s/null" % (obj),
                                 method="DELETE",
                                 headers={'sharedpass': sharedpass})
        record.delete()
Exemple #6
0
def del_by_obj_type(obj, type):
    """deletes any and all entities with given obj_id and type"""
    query = Relation.gql("WHERE obj_id = :1 AND type = :2", obj, type)
    for record in query:
        rpc = urlfetch.create_rpc()
        urlfetch.make_fetch_call(rpc,
                                 cmdurl + "/relation/type?%s/%s/null" %
                                 (type, obj),
                                 method="DELETE",
                                 headers={'sharedpass': sharedpass})
        record.delete()
Exemple #7
0
def delete(subj, type, obj):
    """deletes any and all entities with given subj_id, type, and obj_id"""
    query = Relation.gql("WHERE subj_id =  :1 AND type = :2 and obj_id = :3",
                         subj, type, obj)
    for record in query:
        rpc = urlfetch.create_rpc()
        urlfetch.make_fetch_call(rpc,
                                 cmdurl + '/relation/all?%s/%s/%s' %
                                 (type, obj, subj),
                                 method="DELETE",
                                 headers={'sharedpass': sharedpass})
        record.delete()
Exemple #8
0
def create_unique(subj, type, obj):
    """creates relation with given subj_id, type, and obj_id, if not already present"""
    query = Relation.gql("WHERE subj_id =  :1 AND type = :2 and obj_id = :3",
                         subj, type, obj)
    if query.count() == 0:
        rpc = urlfetch.create_rpc()
        urlfetch.make_fetch_call(rpc,
                                 cmdurl + '/relation/?%s/%s/%s' %
                                 (type, obj, subj),
                                 method="PUT",
                                 headers={'sharedpass': sharedpass})
        record = Relation(subj_id=subj, type=type, obj_id=obj)
        record.put()
Exemple #9
0
def getby_subj_obj_type(subj, obj, type):
    return Relation.gql("WHERE subj_id =  :1 AND type = :2 and obj_id = :3", subj, type, obj)
Exemple #10
0
def getby_subj_obj(subj, obj):
    """returns all relation entities with given subj_id and obj_id"""
    return Relation.gql("WHERE subj_id = :1 AND obj_id = :2", subj, obj)
Exemple #11
0
def getby_obj_type(obj, type):
    """returns all relation entities with given obj, type"""
    return Relation.gql("WHERE obj_id = :1 AND type = :2", obj, type)
Exemple #12
0
def getby_subj_type(subj, type):
    """returns all relation entities with given subj, type"""
    return Relation.gql("WHERE subj_id = :1 AND type = :2", subj, type)
Exemple #13
0
def getby_subj_obj_type(subj, obj, type):
    return Relation.gql("WHERE subj_id =  :1 AND type = :2 and obj_id = :3",
                        subj, type, obj)
Exemple #14
0
def getby_subj_obj(subj, obj):
    """returns all relation entities with given subj_id and obj_id"""
    return Relation.gql("WHERE subj_id = :1 AND obj_id = :2", subj, obj)
Exemple #15
0
def getby_obj_type(obj, type):
    """returns all relation entities with given obj, type"""
    return Relation.gql("WHERE obj_id = :1 AND type = :2", obj, type)
Exemple #16
0
def getby_subj_type(subj, type):
    """returns all relation entities with given subj, type"""
    return Relation.gql("WHERE subj_id = :1 AND type = :2", subj, type)