Example #1
0
def item_save():
    
    item={}
    stomp_connection = messaging_helper.getConnection()
    try:
        logging_debug(request.form.get('item_name'))
        item_name = request.form['item_name']
        description = request.form['description']
        brand = request.form['brand']
        price = request.form['price']
        category = request.form['category']
        image_url_1 = request.form['image_url_1']
        image_url_2 = request.form['image_url_2']
        image_url_3 = request.form['image_url_3']
        owner_id = request.form['owner_id']
        owner_name = request.form['owner_name']
        gotwish = request.form['gotwish']
        
        
        item['item_name'] = item_name
        item['description'] = description
        item['brand'] = brand
        item['price'] = price
        item['category'] = category
        item['image_url_1'] = image_url_1
        item['image_url_2'] = image_url_2
        item['image_url_3'] = image_url_3
        item['owner_id'] = owner_id
        item['owner_name'] = owner_name
        item['gotwish'] = gotwish
                
        logging_debug(item)
        
        item_id = dao.insert_item(item)
        
        worker_item = {}
        worker_item['owner_id'] = owner_id
        worker_item['item_id'] = item_id
        worker_item['work_type'] = "save"
        worker_item['category'] = category
        worker_item['gotwish'] = gotwish
        
        logging_debug(json.dumps(worker_item))
        
        stomp_connection.send(json.dumps(worker_item), destination='/topic/test')
        
        
    except KeyError, e:
        logging_debug(KeyError)
        logging_debug(e)
Example #2
0
def signup_oauth():
    user = {}
    try:
        oauth_id = request.form.get('oauth_id')
        oauth_provider = request.form['oauth_provider']
        user_name = request.form['user_name']
        real_name = request.form['real_name']
        email = request.form['email']
        profile_image_url = request.form['profile_image_url']
        profile_desc = request.form['profile_desc']
        location = request.form['location']
        
        user['oauth_id'] = oauth_id
        user['oauth_provider'] = oauth_provider
        user['user_name'] = user_name
        user['real_name'] = real_name
        user['email'] = email
        user['profile_image_url'] = profile_image_url
        user['profile_desc'] = profile_desc
        user['location'] = location
    except KeyError, e:
        logging_debug(e)
Example #3
0
def signin_oauth():
    oauth_id = request.args.get('oauth_id')
    oauth_provider =request.args.get('oauth_provider')
    logging_debug(oauth_id)
    logging_debug(oauth_provider)
    
    user_id = dao.get_user_id(oauth_id, oauth_provider)
    logging_debug(user_id)
    
    result={}
    result['oauth_id'] = oauth_id
    result['oauth_provider'] = oauth_provider
    result['user_id'] = user_id
    if user_id is not '':
        result['is_member'] = True
    else:
        result['is_member'] = False
    
    return jsonify(result)
Example #4
0
def get_tiger_engine(item_id):
    db_index = tiger_mapper.get_db_index(item_id)
    logging_debug('tiger shard ' + str(db_index) + 'selected')
    return tiger_db_engine[db_index]
Example #5
0
def get_onitsuka_db_engine(user_id):
    db_index = onitsuka_mapper.get_db_index(user_id)
    logging_debug('onitsuka shard ' + str(db_index) + 'selected')
    return onitsuka_db_engine[db_index]
Example #6
0
        profile_image_url = request.form['profile_image_url']
        profile_desc = request.form['profile_desc']
        location = request.form['location']
        
        user['oauth_id'] = oauth_id
        user['oauth_provider'] = oauth_provider
        user['user_name'] = user_name
        user['real_name'] = real_name
        user['email'] = email
        user['profile_image_url'] = profile_image_url
        user['profile_desc'] = profile_desc
        user['location'] = location
    except KeyError, e:
        logging_debug(e)
    
    logging_debug(user)
    user_id = dao.insert_user(user)
    logging_debug(user_id)
    
    
    result={}
    result['user_id'] = user_id
    
    return jsonify(result)


@mod.route('/list/follower/<user_id>')
def get_follower(user_id):
    list = dao.get_follower_list(user_id)
    return jsonify(followers=list)