Beispiel #1
0
def update_info(user_id, old_brand, new_brand, email):
    if new_brand is not None:
        Mapping.collection().update({"uid": user_id, "brand_name": old_brand}, {"$set": {"brand_name": new_brand}})
        BrandMapping.collection().update({"uid": user_id, "brand_name": old_brand}, {"$set": {"brand_name": new_brand}})
        FBUser.collection().update({"u_id": user_id, "brand_name": old_brand}, {"$set": {"brand_name": new_brand}})
        TWUser.collection().update({"u_id": user_id, "brand_name": old_brand}, {"$set": {"brand_name": new_brand}})
        FSQUser.collection().update({"u_id": user_id, "brand_name": old_brand}, {"$set": {"brand_name": new_brand}})
    if email is not None:
        User.collection().update({"_id": user_id}, {"$set": {"emails.0.address": email}})
Beispiel #2
0
def get_user(user_id):
    coll = User.collection()
    dic = coll.find_one({"_id": user_id})
    user_obj = User.unserialize(dic) if dic is not None else None
    return user_obj