Esempio n. 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}})
Esempio n. 2
0
def save(mapping_obj):
    col = Mapping.collection()
    id = col.insert(mapping_obj.serialize())
    return id
Esempio n. 3
0
def del_mapping(mapping_obj_id):
    collection = Mapping.collection()
    if mapping_obj_id is None:
        return None
    dic = collection.update({"_id": coerce_bson_id(mapping_obj_id)}, {"$set": {"is_deleted": 1} })
Esempio n. 4
0
def get_mapping(mapping_obj_id):
    collection = Mapping.collection()
    if mapping_obj_id is None:
        return None
    dic = collection.find_one({"_id": coerce_bson_id(mapping_obj_id)})
    return Mapping.unserialize(dic) if dic is not None else None