コード例 #1
0
def getProfPic(user_id):
    picDb = db.getPic(user_id)
    if (picDb != None):
        pic = b64encode(picDb[0]).decode('"utf-8"')

    else:
        pic = None
    return pic
def profile():
    activityIDs = getActivityIDs(current_user.id)
    activities = []
    print("Current User ID", file=sys.stderr)
    print(current_user.id, file=sys.stderr)

    print("Activity IDs", file=sys.stderr)
    print(activityIDs, file=sys.stderr)
    if activityIDs:
        if activityIDs[0]:
            for ids in activityIDs:
                activ = getActivity(ids[0])
                image = b64encode(activ[2]).decode('"utf-8"')
                likes = 0  # Change for likes

                a = {
                    'title': activ[0],
                    'description': activ[1],
                    'image': image,
                    'activity_id': activ[4]
                }
                activities.append(a)

    activities.reverse()

    i = getInfo(current_user.id)

    info = {
        'about': i[0],
        'interests': i[0],
        'location': i[0],
        'gender': i[0],
        'email': i[0]
    }
    picDb = getPic(current_user.id)
    print(picDb, file=sys.stderr)
    if (picDb != None):
        pic = b64encode(picDb[0]).decode('"utf-8"')

    else:
        pic = None
    return render_template('profile.html',
                           activities=activities,
                           title='Activities',
                           info=info,
                           pic=pic)
コード例 #3
0
def profile():
    activityIDs = db.getActivityIDs(current_user.id)
    activities = []
    if activityIDs:
        if activityIDs[0]:
            for ids in activityIDs:
                activ = db.getActivity(ids[0])
                image = b64encode(activ[2]).decode('"utf-8"')
                likes = 0  # Change for likes

                a = {
                    'title': activ[0].decode(),
                    'description': activ[1].decode(),
                    'image': image,
                    'activity_id': activ[4]
                }
                activities.append(a)

    activities.reverse

    i = db.getInfo(current_user.id)

    info = {
        'about': i[0].decode(),
        'interests': i[1].decode(),
        'location': i[2],
        'gender': i[3].decode(),
        'email': i[4].decode()
    }
    picDb = db.getPic(current_user.id)

    if (picDb != None):
        pic = b64encode(picDb[0]).decode('"utf-8"')

    else:
        pic = None
    return render_template('profile.html',
                           activities=activities,
                           title='Activities',
                           info=info,
                           pic=pic)
コード例 #4
0
def profileSettings():
    print("Current User ID", file=sys.stderr)
    print(current_user.id, file=sys.stderr)

    i = db.getInfo(current_user.id)

    info = {
        'about': i[0].decode(),
        'interests': i[0].decode(),
        'location': i[0],
        'gender': i[0],
        'email': i[0]
    }
    picDb = db.getPic(current_user.id)
    print(picDb, file=sys.stderr)
    if (picDb != None):
        pic = b64encode(picDb[0]).decode('"utf-8"')

    else:
        pic = None
    return render_template('settings.html', info=info, pic=pic)
コード例 #5
0
def vprofile(user_id):

    print(db.checkBlock(user_id, current_user.id), file=sys.stderr)

    # Checks that logged in user is able to see site
    if (db.checkBlock(user_id, current_user.id)):
        print("Here", file=sys.stderr)
        return render_template('404.html'), 404

    blocked = False

    if (db.checkBlock(current_user.id, user_id)):
        blocked = True

    print(user_id, file=sys.stderr)
    picDb = db.getPic(user_id)
    if (picDb != None):
        profPic = b64encode(picDb[0]).decode('"utf-8"')

    else:
        profPic = None
    pic = db.getPic(current_user.id)
    if (pic != None):
        pic = b64encode(pic[0]).decode('"utf-8"')

    else:
        pic = None

    activityIDs = db.getActivityIDs(user_id)
    returnedInfo = db.userInfo(user_id)

    print("RETURNEDINFO", flush=True)
    print(returnedInfo, flush=True)
    activities = []
    print("User ID", file=sys.stderr)
    print(user_id, file=sys.stderr)

    print("Activity IDs", file=sys.stderr)
    print(activityIDs, file=sys.stderr)
    if activityIDs:
        if activityIDs[0]:
            for ids in activityIDs:
                activ = db.getActivity(ids[0])

                print("ACTIV", file=sys.stderr)
                print(activ, file=sys.stderr)
                image = b64encode(activ[2]).decode('"utf-8"')
                likes = 0  # Change for likes

                a = {
                    'title': activ[0].decode('"utf-8"'),
                    'description': activ[1].decode('"utf-8"'),
                    'image': image,
                    'activity_id': activ[4]
                }
                activities.append(a)

    activities.reverse()
    return render_template('otherprofile.html',
                           activities=activities,
                           title='Activities',
                           returnedInfo=returnedInfo,
                           pic=pic,
                           profPic=profPic,
                           blocked=blocked,
                           user_id=user_id)