Beispiel #1
0
def admin_list(request):
    """
    """
    limit, page = limitAndPage(request)

    skip = limit*page
    users = User.view('user/all', skip=skip, limit=limit, descending=True)

    return {'users': users,
            'page': page}
Beispiel #2
0
def contacts(request):
    """
    """
    limit, page = limitAndPage(request)

    users = User.view('viewFollowers/all', limit=limit,
                      descending=True, skip=limit*page,
                      key=request.session['login'])

    return {"users": users, 'limit': limit, 'page': page}
Beispiel #3
0
def coherence():
    """
    """
    parser = argparse.ArgumentParser()
    parser.add_argument('--conf',
                        help='wsgi conf file')

    parser.add_argument('--userid',
                        help='user id')

    args = parser.parse_args()

    config = ConfigParser.RawConfigParser()
    config.read(args.conf)

    server = couchdbkit.Server(config.get('app:main', 'couchdb.url'))
    db = server.get_or_create_db(config.get('app:main','couchdb.db'))

    User.set_db(db)
    Link.set_db(db)


    users = User.view('user/all', descending=True)

    for user in users:
        print "user %s" % user._id

        links = Link.view('purge/all',
                          key=user._id,
                          include_docs=True)

        for link in links:
            print "checking %s" % link._id
            if link._id not in user.links:
                print "adding %s" % link._id
                user.links[link._id] = link.created

        user.save()