Ejemplo n.º 1
0
def InsertUser():
    name = request.form.get('name')
    lastname = request.form.get('lastname')
    mail = request.form.get('mail')
    password = request.form.get('password')
    user = User("NULL", name, lastname, mail, password)
    user.InsertUser(name, lastname, mail, password)
    return redirect("/user")
Ejemplo n.º 2
0
def home():
    active = False
    user = User('', '', '', '', '')
    if 'idUser' in session:
        active = True
        user = User.SelectUserID(session['idUser'])
    listaVuelosUser = FlightUser.SelectUsers(user.idUser)
    return render_template('UserHome.html',
                           active=active,
                           admin=user.administrador,
                           listaVuelosUser=listaVuelosUser)
Ejemplo n.º 3
0
def confirmSignUp():
    name = request.form.get('name')
    lastname = request.form.get('lastname')
    mail = request.form.get('mail')
    password = request.form.get('password')
    confirmPassword = request.form.get('confirmPassword')
    if confirmPassword != password:
        return render_template('SignUp.html')
    user = User("NULL", name, lastname, mail, password)
    user.InsertUser(name, lastname, mail, password)
    if not user.idUser in session:
        session['idUser'] = user.idUser
    return redirect('/home')
Ejemplo n.º 4
0
def confirmSignIn():
    mail = request.form.get('mail')
    password = request.form.get('password')
    user = User.SelectUserMailPassword(mail, password)
    if user is None:
        return redirect('/signIn')
    if not user.idUser in session:
        session['idUser'] = user.idUser
    return redirect('/home')
Ejemplo n.º 5
0
def editUser():
    idUser = request.form.get('idUser')
    name = request.form.get('name')
    lastname = request.form.get('lastname')
    mail = request.form.get('mail')
    password = request.form.get('password')
    user = User.SelectUserID(idUser)
    user.UpdateUser(name, lastname, mail, password)
    return redirect('/user')
Ejemplo n.º 6
0
def insertFlightUser():
    idFlight = request.form.get('idFlight')
    idUser = request.form.get('idUser')
    seatNumber = request.form.get('seatNumber')
    flight = Flight.SelectFlightsID(idFlight)
    user = User.SelectUserID(idUser)
    seat = Seats.SelectSeatsID(seatNumber)
    flightUser = FlightUser(flight, user, seat)
    flightUser.InsertFlightUser()
    return redirect('/flightUser')
Ejemplo n.º 7
0
def reservarViaje():
    idFlight = request.form.get('idFlight')
    idSeat = request.form.get('idSeat')
    flight = Flight.SelectFlightsID(idFlight)
    user = User.SelectUserID(session['idUser'])
    seat = Seats.SelectSeatsID(idSeat)
    flightUser = FlightUser(flight, user, seat)
    if flightUser not in FlightUser.SelectFlightUser():
        flightUser.InsertFlightUser()
    return redirect('home')
Ejemplo n.º 8
0
def editFlightUser():
    oldIDFlight = request.form.get('oldIDFlight')
    oldIDUser = request.form.get('oldIDUser')
    idFlight = request.form.get('idFlight')
    idUser = request.form.get('idUser')
    seatNumber = request.form.get('seatNumber')
    flight = Flight.SelectFlightsID(idFlight)
    user = User.SelectUserID(idUser)
    seat = Seats.SelectSeatsID(seatNumber)
    flightUser = FlightUser.SelectFlightUserID(oldIDFlight, oldIDUser)
    flightUser.UpdateFlightUser(flight, user, seat)
    return redirect('/flightUser')
Ejemplo n.º 9
0
def deleteUser():
    idUser = request.args.get('idUser')
    User.DeleteUser(idUser)
    return redirect("/user")
Ejemplo n.º 10
0
def user():
    listaUser = User.SelectUser()
    return render_template('User.html', listaUser=listaUser)
Ejemplo n.º 11
0
def get_user_info(username):
    data = {
        "query":
        'query {user(login:"******"){contributedRepositories(last:100){edges{node{name url}}}followers(last:20){edges{node{login'
        % username +
        '}}}following(last:20){edges{node{login}}}issues(last:20){edges{node{labels(first:5){nodes{name}}'
        +
        '}}}organizations(last:20){edges{node{name}}}pullRequests(last:20){edges{node{title'
        +
        '}}}repositories(last:20){edges{node{name url}}}starredRepositories(last:20){edges{node{name}}}'
        + 'watching(last:20){edges{node{name}}}}}'
    }
    headers = {
        'Authorization': 'token 8c12627af039588a6c63e9a735e8a145dd641fee'
    }

    req = request.Request(url='https://api.github.com/graphql',
                          data=json.dumps(data).encode('utf-8'),
                          headers=headers)
    resopnse = request.urlopen(req)
    infomation = resopnse.read().decode('utf-8')

    info = json.loads(infomation)

    addinfo.append_contributedRepositories(
        info, addinfo.contributedRepositories_list)
    addinfo.append_contributedRepositories_url(
        info, addinfo.contributedRepositories_url_list)
    addinfo.append_followers(info, addinfo.followers_list)
    addinfo.append_following(info, addinfo.following_list)
    addinfo.append_issues(info, addinfo.issues_list)
    addinfo.append_organizations(info, addinfo.organizations_list)
    addinfo.append_pullRequests(info, addinfo.pullRequests_list)
    addinfo.append_repositories(info, addinfo.repositories_list)
    addinfo.append_repositories_url(info, addinfo.repositories_url_list)
    addinfo.append_starredRepositories(info, addinfo.starredRepositories_list)
    addinfo.append_watching(info, addinfo.watching_list)

    user_info = User(addinfo.contributedRepositories_list,
                     addinfo.contributedRepositories_url_list,
                     addinfo.followers_list, addinfo.following_list,
                     addinfo.issues_list, addinfo.organizations_list,
                     addinfo.pullRequests_list, addinfo.repositories_list,
                     addinfo.repositories_url_list,
                     addinfo.starredRepositories_list, addinfo.watching_list)
    '''print('%s %s %s %s %s %s %s %s %s' % (user_info.set_contributedRepositories(), user_info.set_contributedRepositories_url(), user_info.set_followers(), user_info.set_following(),
                                          user_info.set_issues(), user_info.set_organizations(), user_info.set_pullRequests(),
                                          user_info.set_repositories(),user_info.ser_repositories_url(),user_info.set_starredRepositories(),user_info.set_watching()))
    '''
    filename = username

    with open(filename + '.json', 'w') as f:
        f.write(
            str(user_info.set_contributedRepositories()) +
            str(user_info.set_contributedRepositories_url()) +
            str(user_info.set_followers()) + str(user_info.set_following()) +
            str(user_info.set_issues()) + str(user_info.set_organizations()) +
            str(user_info.set_pullRequests()) +
            str(user_info.set_repositories()) +
            str(user_info.set_repositories_url()) +
            str(user_info.set_starredRepositories()) +
            str(user_info.set_watching()))
    following_username = addinfo.following_list
    return following_username
 def GetFlightUser(dic):
     flight = Flight.SelectFlightsID(dic["idFlight"])
     user = User.SelectUserID(dic["idUser"])
     seat = Seats.SelectSeatsID(dic["seatNumber"])
     return flight, user, seat
Ejemplo n.º 13
0
    ..............Menu Options................
    .                                        .
    . [1] User register                      .
    . [2] Show Users                         .
    . [3] Create post                        .
    . [4] Create comment                     .
    . [5] List post by user                  .
    . [6] Show the comments of post          .
    . [7] Exit                               .
    ..........................................
    """)
    optionSelected = int(input("Select an option: "))
    return optionSelected


user = User()

optionSelected = menu()

while optionSelected > 0 and optionSelected <= 7:

    if optionSelected == 1:
        userDictyonary = user.createUser(userDictyonary)
    elif optionSelected == 2:
        user.showAllUsers(userDictyonary)

    elif optionSelected == 3:
        postDictyonary = user.createPost(postDictyonary, userDictyonary)

    elif optionSelected == 4:
        commentDictyonary = user.createComment(commentDictyonary,