Example #1
0
def cleanup_diff_db():

    for entry in state_diff.find():

        username = entry['username']
        profile = get_dht_profile(username)

        if profile is None:
            #print "Not registered: %s" % username
            continue

        dht_profile_hash = get_hash(profile)

        check_user = users.find_one({"username": username})
        try:
            db_profile_hash = get_hash(check_user['profile'])
        except:
            db_profile_hash = None
            print "ERROR: %s not in DB" % username

        if dht_profile_hash == db_profile_hash:
            print "registered: %s" % username
            state_diff.remove({"username": username})
        else:
            print "profile hash doesn't match: %s" % username
Example #2
0
def populate_diff_db():

    counter = 0
    for new_user in registrations.find():

        user_id = new_user['user_id']
        user = users.find_one({"_id": user_id})

        if user is None:
            continue

        if not user['username_activated']:
            continue

        username = user['username']

        if username in IGNORE_USERNAMES:
            continue

        resp = bs_client.lookup(username + "." + DEFAULT_NAMESPACE)
        resp = resp[0]

        if resp is None:
            insert_state_diff(username, user['profile'],
                              str(user['namecoin_address']))
            counter += 1

    print counter
def process_name_updates(list_usernames):

    for username in list_usernames:
        if check_ownership(username):

            user = users.find_one({"username": username})
            insert_state_diff(username, user['profile'], str(user['namecoin_address']))
def cleanup_diff_db():

    for entry in state_diff.find():

        username = entry['username']
        profile = get_dht_profile(username)

        if profile is None:
            #print "Not registered: %s" % username
            continue

        dht_profile_hash = get_hash(profile)

        check_user = users.find_one({"username": username})
        try:
            db_profile_hash = get_hash(check_user['profile'])
        except:
            db_profile_hash = None
            print "ERROR: %s not in DB" % username

        if dht_profile_hash == db_profile_hash:
            print "registered: %s" % username
            state_diff.remove({"username": username})
        else:
            print "profile hash doesn't match: %s" % username
def populate_diff_db():

    counter = 0
    for new_user in registrations.find():

        user_id = new_user['user_id']
        user = users.find_one({"_id": user_id})

        if user is None:
            continue

        if not user['username_activated']:
            continue

        username = user['username']

        if username in IGNORE_USERNAMES:
            continue

        resp = bs_client.lookup(username + "." + DEFAULT_NAMESPACE)
        resp = resp[0]

        if resp is None:
            insert_state_diff(username, user['profile'], str(user['namecoin_address']))
            counter += 1

    print counter
Example #6
0
def process_name_updates(list_usernames):

    for username in list_usernames:
        if check_ownership(username):

            user = users.find_one({"username": username})
            insert_state_diff(username, user['profile'],
                              str(user['namecoin_address']))