Ejemplo n.º 1
0
def buypage(txid):
    FirstName = str(search_value('first_name', str(current_user.username)))
    LastName = str(search_value('last_name', current_user.username))

    if request.method == 'POST':
        SellerName = str(search_OrderValue('S_username', txid=txid))
        sub = request.form.get("submit")
        if sub == 'submit':
            msg = request.form.get("message")
            newMsg(txid, current_user.username, SellerName,
                   current_user.username, msg)
            confirmBuyer(current_user.username, txid)
            return (redirect(url_for('active_drops')))
    else:
        url = []
        img = search_allImages(search_OrderValue('img_url', txid=txid))
        for item in img:
            try:
                img_url = item.url
                img_url = str(img_url)
                url.append(img_url)
            except IndexError:
                img_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAMFBMVEXp7vG6vsHs8fS3u77Cxsnn7O/d4uXFyczN0dTKztHS19rk6ezi5+rX3N+9wcS1ubzIzxKwAAACWElEQVR4nO3b4XKiMBRAYUkUhQT6/m+7CK2GABJjdrl3e75/djo0p2FIGOF0AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAczpRxdMa2rrkW0LQnmY2mtrYqwtpWYqLpvsr0jY0SEy+FJvA7sT66Z8E0JQOr6ixuEs00sKaAaRKPDloYT1LblVgrvBV5ml4KDuu/Lyz5zyroFxYOe6/M/ZeOQtNdrbV9e8loVFHo+mn9t8PV9cNDiTEbln/ubzL2XxoKw83J19tDlV9obrMtav/uJCoonO/B3x6r/MI6KrxtTaK57B1KkmBYXXQf1WwUDrcjq4nyC+u0QtMMv7eWKL/QR2fp+noxBq4myi9MutJ8B64lKihMWC0egSuJ8gsTVvwgcJmooXBv1zYLXCRqKNzZeUeBcaKKwvvdU7V197QIjBJ1FL64A14JnCdqKdyyGjhLVF64ERgm6i7cDAwSVRe+CHwmKiv0PvjwMvCRqKvQWeseH3YCfxJVFbr7D38SdwOrym0f6nCrw3LBuFMCpy2eokIXTk1CoLpC9xy5SwrUVujCsbuUQGWFbj72hD5lhW6vRnthVqCmwrxARYWZgXoKcwPVFGYHqimMv7egkEIhKKSQwuOFhedsXXQoScJhffgagoJCOYcqicJ3yCychtWWeM57fFrF+v0/+W+Zfrzc519Gn8bFRt6z+tEDGB+7invfYv4AxseCbzvk8AUnMefR4r/PuLMtpPcSAwfGt7cC2lpo312JxULyK6QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8Gv8AbboIxLMxQycAAAAAElFTkSuQmCC"
                url.append(img_url)
        item_name = search_OrderValue('I_name', txid=txid)
        location = search_OrderValue('Location', txid=txid)
        item_desc = search_OrderValue('description', txid=txid)
        item_cost = search_OrderValue('Cost', txid=txid)
        SellerName = search_OrderValue('S_username', txid=txid)
        date_init = date_time(search_OrderValue('date_initialized', txid=txid))
        return render_template("buyPage(new).html", FirstName = FirstName, \
            LastName = LastName, i_name = item_name,\
            location = location, i_desc = item_desc, i_cost = item_cost,\
            SellerName = SellerName, date_init = date_init, \
            currentuser = current_user.username, txid = txid, url=url)
Ejemplo n.º 2
0
def new_drop():
    FirstName = str(search_value('first_name', str(current_user.username)))
    LastName = str(search_value('last_name', current_user.username))
    if request.method == 'POST':
        user = str(current_user.username)
        I_name = request.form["Item_name"]
        I_cost = request.form["Item_cost"]
        I_desc = request.form["Item_desc"]
        location = request.form["location"]
        url = request.form["main_image"]
        url2 = request.form["main2_image"]
        url3 = request.form["main3_image"]
        url4 = request.form["main4_image"]
        url5 = request.form["main5_image"]
        S_name = str(current_user.username)
        B_name = 'None'
        txid = newOrder(S_name, B_name, I_name, I_desc, I_cost, location)
        if url != "undefined":
            url_id = search_OrderValue('img_url', txid=txid)
            newImage(url_id, txid, user, url)
        if url2 != "undefined":
            url_id = search_OrderValue('img_url', txid=txid)
            newImage(url_id, txid, user, url2)
        if url3 != "undefined":
            url_id = search_OrderValue('img_url', txid=txid)
            newImage(url_id, txid, user, url3)
        if url4 != "undefined":
            url_id = search_OrderValue('img_url', txid=txid)
            newImage(url_id, txid, user, url4)
        if url5 != "undefined":
            url_id = search_OrderValue('img_url', txid=txid)
            newImage(url_id, txid, user, url5)
        return redirect(url_for('active_drops'))
    return render_template("new_drop.html", FirstName = FirstName,\
    LastName = LastName)
Ejemplo n.º 3
0
def transactionpage(chat_id):
    FirstName = str(search_value('first_name', str(current_user.username)))
    LastName = str(search_value('last_name', current_user.username))

    request_code = url_for('confirmTX', chat_id=chat_id)
    code_msg = dropStatus(chat_id, current_user.username, msg=True)
    if search_OrderValue('status', txid=chat_id) == "Buyer_Seller_TX_Confirm":
        code_msg = 'Request Box Access Code'
    item_name = search_OrderValue('I_name', txid=chat_id)
    location = search_OrderValue('Location', txid=chat_id)
    item_desc = search_OrderValue('description', txid=chat_id)
    item_cost = search_OrderValue('Cost', txid=chat_id)
    buy_user = search_OrderValue('B_username', txid=chat_id)
    sell_user = search_OrderValue('S_username', txid=chat_id)
    date_init = date_time(search_OrderValue('date_initialized', txid=chat_id))
    oldMsg = searchMsg(chat_id)
    oldMsgTime = []
    oldMsgMsg = []
    oldMsgSender = []
    for item in oldMsg:
        try:
            oldMsgSender.append(item.Sender_username)
            oldMsgMsg.append(item.msg)
            oldMsgTime.append(date_time(item.msg_date))
        except TypeError:
            oldMsgTime.append('<i>time not available</i>')


    return render_template('message.html', currentuser = \
    str(current_user.username), FirstName=FirstName, LastName=LastName, \
    chatid = chat_id, item_name=item_name, location = location, \
    item_desc=item_desc, item_cost=item_cost, buy_user=buy_user, \
    sell_user=sell_user, date_init=date_init, oldMsgMsg = oldMsgMsg, oldMsgSender=oldMsgSender,\
    request_code = request_code, code_msg = code_msg, oldMsgTime=oldMsgTime)
Ejemplo n.º 4
0
def profile():
    FirstName = str(search_value('first_name', str(current_user.username)))
    LastName = str(search_value('last_name', current_user.username))
    Age = str(search_value('age', current_user.username))
    Email = str(search_value('email', current_user.username))
    date_joined_ugly = datetime.strptime(
        search_value('date_joined', current_user.username),
        '%Y-%m-%d %H:%M:%S.%f')
    date_joined = date_joined_ugly.strftime("%B %d, %Y")
    Address = str(search_value('address', current_user.username))
    user_rating = str(search_value('user_rating', current_user.username))
    id = str(search_value('id', current_user.username))
    status = search_value('status', current_user.username)
    bucks = searchBucks(current_user.username)
    return render_template("profile.html", FirstName=FirstName, id=id, \
        LastName=LastName, Age=Age, Email=Email, date_joined=date_joined, \
        Address=Address, user_rating=user_rating, status=status, bucks=bucks)
Ejemplo n.º 5
0
def history():
    FirstName = str(search_value('first_name', str(current_user.username)))
    LastName = str(search_value('last_name', current_user.username))

    h_txid = search_allOrders(SUN=current_user.username,
                              BUN=current_user.username)
    h_txids = []
    b_names = []
    s_names = []
    h_item = []
    h_price = []
    h_location = []
    h_date_open = []
    h_date_close = []
    h_status = []
    h_txstatus = []
    h_url = []
    for item in h_txid:
        txid = str(item)
        h_txids.append(item.TXID)
        b_names.append(item.B_username)
        s_names.append(item.S_username)
        h_item.append(item.I_name)
        h_price.append(item.Cost)
        h_location.append(item.Location)
        h_date_open.append(item.date_initialized)
        h_date_close.append(item.date_resolved)
        h_txstatus.append(item.status)
        h_status.append(search_OrderValue('status', item.TXID))
        h_url.append(item.img_url)
    currentuser = current_user.username
    return render_template('history.html', FirstName=FirstName, currentuser=currentuser, \
        LastName = LastName, h_txids=h_txids, b_names=b_names, s_names=s_names,\
        h_item=h_item, h_price=h_price, h_location=h_location, h_url=h_url,\
        h_date_open=h_date_open, h_date_close=h_date_close,\
        h_status=h_status, h_txstatus = h_txstatus)
Ejemplo n.º 6
0
def browse(page_id):
    FirstName = str(search_value('first_name', str(current_user.username)))
    LastName = str(search_value('last_name', current_user.username))

    if request.method == "POST":
        searchValue = request.form.get("Search")

        SellerName = []
        ItemName = []
        ItemDesc = []
        ItemCost = []
        Location = []
        date_post = []
        txid = []
        url = []

        load_start = (page_id - 1) * 10
        load_pages = []
        load_txids = browseRecent()

        load_pages = load_txids[load_start:(load_start + 10)]

        for item in load_pages:
            if item.S_username != None:
                if SequenceMatcher(None, item.I_name,
                                   searchValue).ratio() > 0.6:
                    SellerName.append(item.S_username)
                    ItemName.append(item.I_name)
                    ItemDesc.append(item.description)
                    ItemCost.append(item.Cost)
                    Location.append(item.Location)
                    date_post.append(date_time(item.date_initialized))
                    txid.append(item.TXID)
                    img = search_allImages(url_id=item.img_url)
                    for item in img:
                        try:
                            img_url = img.url
                            img_url = str(img)
                        except IndexError:
                            img_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAMFBMVEXp7vG6vsHs8fS3u77Cxsnn7O/d4uXFyczN0dTKztHS19rk6ezi5+rX3N+9wcS1ubzIzxKwAAACWElEQVR4nO3b4XKiMBRAYUkUhQT6/m+7CK2GABJjdrl3e75/djo0p2FIGOF0AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAczpRxdMa2rrkW0LQnmY2mtrYqwtpWYqLpvsr0jY0SEy+FJvA7sT66Z8E0JQOr6ixuEs00sKaAaRKPDloYT1LblVgrvBV5ml4KDuu/Lyz5zyroFxYOe6/M/ZeOQtNdrbV9e8loVFHo+mn9t8PV9cNDiTEbln/ubzL2XxoKw83J19tDlV9obrMtav/uJCoonO/B3x6r/  MI6KrxtTaK57B1KkmBYXXQf1WwUDrcjq4nyC+u0QtMMv7eWKL/QR2fp+noxBq4myi9MutJ8B64lKihMWC0egSuJ8gsTVvwgcJmooXBv1zYLXCRqKNzZeUeBcaKKwvvdU7V197QIjBJ1FL64A14JnCdqKdyyGjhLVF64ERgm6i7cDAwSVRe+CHwmKiv0PvjwMvCRqKvQWeseH3YCfxJVFbr7D38SdwOrym0f6nCrw3LBuFMCpy2eokIXTk1CoLpC9xy5SwrUVujCsbuUQGWFbj72hD5lhW6vRnthVqCmwrxARYWZgXoKcwPVFGYHqimMv7egkEIhKKSQwuOFhedsXXQoScJhffgagoJCOYcqicJ3yCychtWWeM57fFrF+v0/+W+Zfrzc519Gn8bFRt6z+tEDGB+7invfYv4AxseCbzvk8AUnMefR4r/PuLMtpPcSAwfGt7cC2lpo312JxULyK6QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8Gv8AbboIxLMxQycAAAAAElFTkSuQmCC"
                        url.append(img_url)
            else:
                pass
        if len(ItemName) == 0:
            searches = "empty"
        else:
            searches = "values"
        return render_template("browse.html", FirstName = FirstName, \
        LastName = LastName, SellerName=SellerName, \
        ItemName=ItemName, ItemDesc=ItemDesc, ItemCost=ItemCost, \
        Location=Location, date_post=date_post, txid=txid, url=url, searches=searches)

    SellerName = []
    ItemName = []
    ItemDesc = []
    ItemCost = []
    Location = []
    date_post = []
    txid = []
    url = []

    load_start = (page_id - 1) * 10
    load_pages = []
    load_txids = browseRecent()

    load_pages = load_txids[load_start:(load_start + 10)]

    for item in load_pages:
        if item.S_username != None:
            SellerName.append(item.S_username)
            ItemName.append(item.I_name)
            ItemDesc.append(item.description)
            ItemCost.append(item.Cost)
            Location.append(item.Location)
            date_post.append(date_time(item.date_initialized))
            txid.append(item.TXID)
            img = search_allImages(url_id=item.img_url)
            if len(img) != 0:
                for item in img:
                    try:
                        img_url = item.url
                        img_url = str(img_url)
                    except IndexError:
                        img_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAMFBMVEXp7vG6vsHs8fS3u77Cxsnn7O/d4uXFyczN0dTKztHS19rk6ezi5+rX3N+9wcS1ubzIzxKwAAACWElEQVR4nO3b4XKiMBRAYUkUhQT6/m+7CK2GABJjdrl3e75/djo0p2FIGOF0AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAczpRxdMa2rrkW0LQnmY2mtrYqwtpWYqLpvsr0jY0SEy+FJvA7sT66Z8E0JQOr6ixuEs00sKaAaRKPDloYT1LblVgrvBV5ml4KDuu/Lyz5zyroFxYOe6/M/ZeOQtNdrbV9e8loVFHo+mn9t8PV9cNDiTEbln/ubzL2XxoKw83J19tDlV9obrMtav/uJCoonO/B3x6r/MI6KrxtTaK57B1KkmBYXXQf1WwUDrcjq4nyC+u0QtMMv7eWKL/QR2fp+noxBq4myi9MutJ8B64lKihMWC0egSuJ8gsTVvwgcJmooXBv1zYLXCRqKNzZeUeBcaKKwvvdU7V197QIjBJ1FL64A14JnCdqKdyyGjhLVF64ERgm6i7cDAwSVRe+CHwmKiv0PvjwMvCRqKvQWeseH3YCfxJVFbr7D38SdwOrym0f6nCrw3LBuFMCpy2eokIXTk1CoLpC9xy5SwrUVujCsbuUQGWFbj72hD5lhW6vRnthVqCmwrxARYWZgXoKcwPVFGYHqimMv7egkEIhKKSQwuOFhedsXXQoScJhffgagoJCOYcqicJ3yCychtWWeM57fFrF+v0/+W+Zfrzc519Gn8bFRt6z+tEDGB+7invfYv4AxseCbzvk8AUnMefR4r/PuLMtpPcSAwfGt7cC2lpo312JxULyK6QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8Gv8AbboIxLMxQycAAAAAElFTkSuQmCC"
                    except TypeError:
                        img_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAMFBMVEXp7vG6vsHs8fS3u77Cxsnn7O/d4uXFyczN0dTKztHS19rk6ezi5+rX3N+9wcS1ubzIzxKwAAACWElEQVR4nO3b4XKiMBRAYUkUhQT6/m+7CK2GABJjdrl3e75/djo0p2FIGOF0AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAczpRxdMa2rrkW0LQnmY2mtrYqwtpWYqLpvsr0jY0SEy+FJvA7sT66Z8E0JQOr6ixuEs00sKaAaRKPDloYT1LblVgrvBV5ml4KDuu/Lyz5zyroFxYOe6/M/ZeOQtNdrbV9e8loVFHo+mn9t8PV9cNDiTEbln/ubzL2XxoKw83J19tDlV9obrMtav/uJCoonO/B3x6r/MI6KrxtTaK57B1KkmBYXXQf1WwUDrcjq4nyC+u0QtMMv7eWKL/QR2fp+noxBq4myi9MutJ8B64lKihMWC0egSuJ8gsTVvwgcJmooXBv1zYLXCRqKNzZeUeBcaKKwvvdU7V197QIjBJ1FL64A14JnCdqKdyyGjhLVF64ERgm6i7cDAwSVRe+CHwmKiv0PvjwMvCRqKvQWeseH3YCfxJVFbr7D38SdwOrym0f6nCrw3LBuFMCpy2eokIXTk1CoLpC9xy5SwrUVujCsbuUQGWFbj72hD5lhW6vRnthVqCmwrxARYWZgXoKcwPVFGYHqimMv7egkEIhKKSQwuOFhedsXXQoScJhffgagoJCOYcqicJ3yCychtWWeM57fFrF+v0/+W+Zfrzc519Gn8bFRt6z+tEDGB+7invfYv4AxseCbzvk8AUnMefR4r/PuLMtpPcSAwfGt7cC2lpo312JxULyK6QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8Gv8AbboIxLMxQycAAAAAElFTkSuQmCC"
                    url.append(img_url)
            else:
                img_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAMFBMVEXp7vG6vsHs8fS3u77Cxsnn7O/d4uXFyczN0dTKztHS19rk6ezi5+rX3N+9wcS1ubzIzxKwAAACWElEQVR4nO3b4XKiMBRAYUkUhQT6/m+7CK2GABJjdrl3e75/djo0p2FIGOF0AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAczpRxdMa2rrkW0LQnmY2mtrYqwtpWYqLpvsr0jY0SEy+FJvA7sT66Z8E0JQOr6ixuEs00sKaAaRKPDloYT1LblVgrvBV5ml4KDuu/Lyz5zyroFxYOe6/M/ZeOQtNdrbV9e8loVFHo+mn9t8PV9cNDiTEbln/ubzL2XxoKw83J19tDlV9obrMtav/uJCoonO/B3x6r/MI6KrxtTaK57B1KkmBYXXQf1WwUDrcjq4nyC+u0QtMMv7eWKL/QR2fp+noxBq4myi9MutJ8B64lKihMWC0egSuJ8gsTVvwgcJmooXBv1zYLXCRqKNzZeUeBcaKKwvvdU7V197QIjBJ1FL64A14JnCdqKdyyGjhLVF64ERgm6i7cDAwSVRe+CHwmKiv0PvjwMvCRqKvQWeseH3YCfxJVFbr7D38SdwOrym0f6nCrw3LBuFMCpy2eokIXTk1CoLpC9xy5SwrUVujCsbuUQGWFbj72hD5lhW6vRnthVqCmwrxARYWZgXoKcwPVFGYHqimMv7egkEIhKKSQwuOFhedsXXQoScJhffgagoJCOYcqicJ3yCychtWWeM57fFrF+v0/+W+Zfrzc519Gn8bFRt6z+tEDGB+7invfYv4AxseCbzvk8AUnMefR4r/PuLMtpPcSAwfGt7cC2lpo312JxULyK6QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8Gv8AbboIxLMxQycAAAAAElFTkSuQmCC"
                url.append(img_url)

        else:
            pass
    return render_template("browse.html", FirstName = FirstName, \
    LastName = LastName, SellerName=SellerName, \
    ItemName=ItemName, ItemDesc=ItemDesc, ItemCost=ItemCost, \
    Location=Location, date_post=date_post, txid=txid, url=url)
Ejemplo n.º 7
0
def active_drops():
    FirstName = str(search_value('first_name', str(current_user.username)))
    LastName = str(search_value('last_name', current_user.username))

    s_txid = search_OrderValue('TXID', S_username=current_user.username)
    s_txids = []
    s_names = []
    s_other_user = []
    s_price = []
    s_location = []
    s_date = []
    s_return = []

    a_txids = []
    a_names = []
    a_price = []
    a_location = []
    a_date = []

    for item in s_txid:
        txid = str(item)
        if (search_OrderValue('status', txid=txid) != "TRANSACTION COMPLETE"):
            if (search_OrderValue('B_username', txid=txid)) != 'None':
                s_txids.append(txid)
                s_names.append(search_OrderValue('I_name', txid=txid))
                s_other_user.append(search_OrderValue('B_username', txid=txid))
                s_price.append(search_OrderValue('Cost', txid=txid))
                s_location.append(search_OrderValue('Location', txid=txid))
                s_date.append(
                    date_time(search_OrderValue('date_initialized',
                                                txid=txid)))
                if (search_OrderValue('status', txid=txid) == "ITEM RETURNED"):
                    s_return.append('waiting')
                else:
                    s_return.append('else')
            else:
                txid = str(item)
                a_txids.append(txid)
                a_names.append(search_OrderValue('I_name', txid=txid))
                a_price.append(search_OrderValue('Cost', txid=txid))
                a_location.append(search_OrderValue('Location', txid=txid))
                a_date.append(
                    date_time(search_OrderValue('date_initialized',
                                                txid=txid)))

    b_txid = search_OrderValue('TXID', B_username=current_user.username)
    b_txids = []
    b_names = []
    b_other_user = []
    b_price = []
    b_location = []
    b_date = []
    for item in b_txid:
        txid = str(item)
        if (search_OrderValue('status', txid=txid) != "TRANSACTION COMPLETE"):
            b_txids.append(txid)
            b_names.append(search_OrderValue('I_name', txid=txid))
            b_other_user.append(search_OrderValue('S_username', txid=txid))
            b_price.append(search_OrderValue('Cost', txid=txid))
            b_location.append(search_OrderValue('Location', txid=txid))
            b_date.append(
                date_time(search_OrderValue('date_initialized', txid=txid)))
    currentuser = current_user.username
    return render_template('active_drops.html', FirstName=FirstName, \
        LastName = LastName, s_txids=s_txids, b_txids = b_txids,\
        s_names=s_names, b_names=b_names, s_other_user = s_other_user, \
        s_price = s_price, s_location = s_location, s_date = s_date,\
        b_other_user = b_other_user, b_price = b_price, b_location = b_location\
        , b_date = b_date, a_price = a_price, a_location = a_location\
        , a_date = a_date, a_txids=a_txids, a_names=a_names, s_return=s_return)