Example #1
0
def participate(key = None):
    app.logger.debug("Entering participate")

    #initialize defaults
    init_session_values()
    flask.session['key_not_found'] = "false"
    
    #get key from the url
    key = request.args.get("key")
    flask.session['key'] = key
    
    #look up some info from the db
    try:
        entry = db_helper.find_by_id(ObjectId(key))
    except bson.errors.InvalidId:
        entry = None
    
    if entry is None:
        flask.session['key_not_found'] = "true"
    else:
        flask.session['free_times'] = entry["free_times"]
        flask.session['daterange'] = entry["bounds"]["daterange"]
        flask.session['confirmed'] = entry["confirmed"]
    
    return render_template('participate.html')
Example #2
0
def choose(key = None):
    app.logger.debug("Entering choose")
    
    #initialize defaults
    flask.session["processed_delete"] = "no"
    flask.session['key_not_found'] = "false"
    
    #get key from the url
    key = request.args.get("key")
    flask.session['key'] = key
    
    #put the access links in the session
    flask.session["choose_url"] = flask.url_for("choose", key = key, _external = True)
    flask.session["participate_url"] = flask.url_for("participate", key = key, _external = True)
    
    #look up some info from the db
    try:
        entry = db_helper.find_by_id(ObjectId(key))
    except bson.errors.InvalidId:
        entry = None
    
    if entry is None:
        flask.session['key_not_found'] = "true"
    else:
        flask.session['free_times'] = entry["free_times"]
        flask.session['confirmed'] = entry["confirmed"]
    
    return render_template('choose.html')