示例#1
0
def delete_role(role_id):
    ''' delete a Role as long as it is not Present in a Place ''' 
    if len(Presence.query(Presence.role == db.Key(urlsafe=role_id)).fetch()) > 0:
        raise ActionException('Role still has presence')
    db.Key(urlsafe=role_id).delete()
示例#2
0
def _get_presences(place_id):
    place = db.Key(urlsafe=place_id)
    return [presence for presence in Presence.query(ancestor=place).fetch()]