Ejemplo n.º 1
0
def set():
    #try:
    if 'user' not in session:
        return redirect("/")
    elif request.method == "POST":

        session["event_in_progress"] = len(
            database_actions.get_events(session["user"]))
        print session["event_in_progress"]
        ID = request.form["fb_id"]
        token = session["token"]
        description = FB.getDescription(token, ID)
        date = FB.getStartTime(token, ID)
        location = FB.getLocation(token, ID)
        attending = FB.getAttending(token, ID)
        maybe = FB.getMaybe(token, ID)
        declined = FB.getDeclined(token, ID)
        not_responded = FB.getUnknown(token, ID)
        print database_actions.add_event(session["user"], request.form["name"],
                                         request.form["theme"], ID,
                                         description, date, location,
                                         attending, declined, maybe,
                                         not_responded)

        return render_template('set.html',
                               events=database_actions.get_events(
                                   session["user"]))
    return redirect("/new")
    #except:
    session.pop("user")
    return redirect("/")
Ejemplo n.º 2
0
def set():
        #try:
                if 'user' not in session:
                        return redirect( "/" )
                elif request.method == "POST":


                    session["event_in_progress"] = len( database_actions.get_events( session["user"] ) )
                    print session["event_in_progress"]
                    ID = request.form["fb_id"]
                    token = session["token"]
                    description = FB.getDescription( token, ID )
                    date = FB.getStartTime( token, ID )
                    location = FB.getLocation( token, ID )
                    attending = FB.getAttending( token, ID )
                    maybe =  FB.getMaybe( token, ID )
                    declined = FB.getDeclined( token, ID )
                    not_responded = FB.getUnknown( token, ID )
                    print database_actions.add_event( session["user"], request.form["name"], request.form["theme"], ID, description, date, location, attending, declined, maybe, not_responded )


                    return render_template( 'set.html', events=database_actions.get_events( session["user"] ) )
                return redirect( "/new" )
        #except:
                session.pop( "user" )
                return redirect( "/" )
Ejemplo n.º 3
0
def updatefb( event_index ):
    if 'user' not in session:
        return redirect( "/" )
    ID = database_actions.get_fbid(session["user"],event_index)
    token = session["token"]
    description = FB.getDescription( token, ID )
    date = FB.getStartTime( token, ID )
    location = FB.getLocation( token, ID )
    attending = FB.getAttending( token, ID )
    maybe =  FB.getMaybe( token, ID )
    declined = FB.getDeclined( token, ID )
    not_responded = FB.getUnknown( token, ID )
    print database_actions.update_event( session["user"], int( event_index.encode("utf8") ), description, date, location, attending, declined, maybe, not_responded)
    return redirect("/event/"+event_index)
Ejemplo n.º 4
0
def updatefb(event_index):
    if 'user' not in session:
        return redirect("/")
    ID = database_actions.get_fbid(session["user"], event_index)
    token = session["token"]
    description = FB.getDescription(token, ID)
    date = FB.getStartTime(token, ID)
    location = FB.getLocation(token, ID)
    attending = FB.getAttending(token, ID)
    maybe = FB.getMaybe(token, ID)
    declined = FB.getDeclined(token, ID)
    not_responded = FB.getUnknown(token, ID)
    print database_actions.update_event(session["user"],
                                        int(event_index.encode("utf8")),
                                        description, date, location, attending,
                                        declined, maybe, not_responded)
    return redirect("/event/" + event_index)