Beispiel #1
0
def create_users(conn):


    users = ['eric', 'cap', 'vimal', 'chicken']
    user_oids = {}
    
    for u in users:
        
        pw_hash = mementa.saltpassword(user_password,
                                       PASSWORDSALT)
        
        user = dm.user_create(u, pw_hash)
        
        db = conn[mementa.app.config['DB_SYSTEM_DATABASE']]
        uoid = db.users.insert(user)
        
        user_oids[u] = uoid
    return user_oids
Beispiel #2
0
    mongoconn = pymongo.Connection(dburl)
else:
    mongoconn = pymongo.Connection()
    
mongoconn.drop_database(DATABASE)

db = mongoconn[DATABASE]

col_user = db['users']
col_entries = db['entries']
col_revisions = db['revisions']


pw = mementa.saltpassword("password", mementa.PASSWORDSALT)

u1 = dm.user_create("eric", pw, "Eric Jonas", "*****@*****.**", twitter="stochastician")

u1oid = col_user.insert(u1)
print u1oid

u2 = dm.user_create("cap", pw, "Cap Petschulat", "*****@*****.**")
u2oid = col_user.insert(u2)
print u2oid

docs_to_create = {'Hello World 1' : 3,
                  'Goodbye World' : 2,
                  'This is a test 1' : 5,
                  "And here is some more": 4,
                  'Goodbye World 2' : 2,
                  'This is a test 3 ' : 5,
                  "And here is some more 4": 4,