def show_home(): """blah""" random_fruit = choice(the_list) print print session print #way #1 that doesn't work: session.setdefault("history", []).append(random_fruit) session.modified = True #way #2 that doesn't work # if "history" in session: # print "about to append", random_fruit # session["history"].append(random_fruit) # else: # print "creating history in session with", random_fruit # session["history"] = [random_fruit] #way #3 (credit to Ally) which DOES work # session["history"] = session.get("history", []) # session["history"].append(random_fruit) print print session.modified print return render_template("index.html", fruit=random_fruit, history=session["history"])
def index(): import random session.setdefault('response', 'default') session.setdefault('number',0) if session['number'] == 0: session['number'] = random.randrange(0, 101) return render_template('index.html')
def link_to_dblp(article_id): app.logger.debug("Running DBLP plugin for article {}".format(article_id)) # Retrieve the article from the session article = session['items'][article_id] # Rewrite the authors of the article in a form understood by utils.baseplugin.SPARQLPlugin article_items = article['authors'] match_items = [{'id': item['id'], 'label': item['full_name'].strip()} for item in article_items] try : # Initialize the plugin plugin = SPARQLPlugin(endpoint = "http://dblp.l3s.de/d2r/sparql", template = "dblp.query") # Run the plugin, and retrieve matches using the FOAF name property matches = plugin.match_separately(match_items, property="foaf:name") # Add the matches to the session session.setdefault(article_id,[]).extend(matches) session.modified = True if matches == [] : matches = None # Return the matches return render_template('urls.html', article_id = article_id, results = [{'title':'DBLP','urls': matches}]) except Exception as e: return render_template( 'message.html', type = 'error', text = e.message )
def add_to_cart(id): """Add a melon to cart and redirect to shopping cart page. When a melon is added to the cart, redirect browser to the shopping cart page and display a confirmation message: 'Successfully added to cart'. """ # TODO: Finish shopping cart functionality # The logic here should be something like: # # - add the id of the melon they bought to the cart in the session id = str(id) session.setdefault("cart", {}) if id in session["cart"]: print "should add one" session["cart"][id] += 1 else: print "creating 1" session["cart"][id] = 1 flash("Melon successfully added to cart!") print session["cart"][id] print session["cart"] return redirect("/melons")
def _authorize_callback(self): session_token = session.get(self._session_key, None) req_token = request.args.get('state') if not req_token or not session_token or session_token != req_token: raise OAuthInvalidSessionState('Invalid session state', details={'req_token': req_token, 'session_token': session_token}, provider=self) # XXX: When people have multiple oauth logins at the same time, e.g. # after restarting their browser and being redirected to SSO pages # the first successful one will remove the redirect uri from the # session so we need to restore it in case it's not set. session.setdefault('{}_oauthredir'.format(self.oauth_app.name), self._get_redirect_uri()) try: resp = self.oauth_app.authorized_response() or {} except flask_oauthlib.client.OAuthException as exc: # older flask-oauthlib versions return the exception instead of # letting it propagate like a normal exception, so we handle both # the properly raised exception and the legacy case. resp = exc if isinstance(resp, flask_oauthlib.client.OAuthException): error_details = {'msg': resp.message, 'type': resp.type, 'data': resp.data} raise AuthenticationFailed('OAuth error', details=error_details, provider=self) elif self.settings['token_field'] not in resp: error = resp.get('error_description', resp.get('error', 'Received no oauth token')) raise AuthenticationFailed(error, provider=self) return self.multipass.handle_auth_success(self._make_auth_info(resp))
def index(): if 'activities' in session: pass else: session['activities'] = [] session.setdefault('score',0) return render_template('index.html')
def add_to_cart(melon_id): """Add a melon to cart and redirect to shopping cart page. When a melon is added to the cart, redirect browser to the shopping cart page and display a confirmation message: 'Successfully added to cart'. """ # TODO: Finish shopping cart functionality # The logic here should be something like: # # - add the id of the melon they bought to the cart in the session melon = melons.get_by_id(melon_id) # Check if the melon ID exists in the session. If it doesn't, add # the ID as a key with a quantity of 0 as its value, and add 1. # Otherwise, add 1 to the quantity. session.setdefault("cart", []).append(melon_id) print "#########" print melon print "#########" print session print "#########" flash("You have added {} to your cart.".format(melon.common_name)) return redirect('/melons')
def generate_player_character(): # (These uses of random are fine even if the player reloads the page. The results get stored in the session, # so the calls won't get executed twice.) first_name_index = session.setdefault("first_name_index", random.randint(0, len(first_names) - 1)) last_name_index = session.setdefault("last_name_index", random.randint(0, len(last_names) - 1)) flesh_act = session.get("flesh_act", initial_game_state["flesh_act"]) job_title_index = session.setdefault( "job_title_index:" + flesh_act, random.randint(0, get_nr_job_titles(flesh_act) - 1) ) PC_data = { "PC_first": first_names[first_name_index], "PC_last": last_names[last_name_index], "PC_job": get_job_title(flesh_act, job_title_index), } first_name_index += 1 last_name_index += 1 job_title_index += 1 if first_name_index >= len(first_names): first_name_index = 0 if last_name_index >= len(last_names): last_name_index = 0 if job_title_index >= get_nr_job_titles(flesh_act): job_title_index = 0 session["first_name_index"] = first_name_index session["last_name_index"] = last_name_index session["job_title_index:" + flesh_act] = job_title_index return PC_data
def store_session(args, token): """ Store something (``args``) in the session, using ``token`` as an unique identifier. """ session.setdefault('args', {}) session['args'][token] = args
def joined(data): user_2 = data.get('id') if user_2 is None: return emit('status', {'flag': False, 'msg': 'id is empty'}) try: user_2 = int(user_2) except ValueError: return emit('status', {'flag': False, 'msg': 'ValueError : id is not int'}) except TypeError: return emit('status', {'flag': False, 'msg': 'TypeError'}) user_1 = session.get('user_id') extra = compare(user_1, user_2) room_id = '%d|%d' % extra session.setdefault('rooms', []) if room_id not in session['rooms']: join_room(room_id) session['rooms'].append(room_id) emit('unique_wire', {'flag': True, 'id': user_2, 'user': user_1}, room=user_2) save_room(room_id, user_1, user_2) chat = take_message(room_id, extra, number=0) context = { 'flag': True, 'room': room_id, 'history': chat, 'id': user_2, } emit('status', context)
def settings(): session.setdefault("default_css", True) session["default_css"] = False if session.get("default_css") else True if session.get("CharacterOwnerHash"): return redirect(session.get("prev_path", url_for("account.home"))) else: return redirect(session.get("prev_path", url_for("home")))
def login_post(): username = request.form["username"] password = request.form["password"] if validate_login(username, password): session.setdefault("logged_in", username) # ok,save session flash("You were logged in") return redirect(url_for("show_entries")) else: error = "Username Or Password Error" return render_template("login.html", username=username, error=error)
def wall_add(msg): # recieving post from .js function add messages, msg = string """Set a new message. msg: (string) message returns: dictionary with messages list + result code. """ wall_dict = {"message": msg,} #create new dict, add one key value pair #print wall_dict session.setdefault('wall', []).append(wall_dict) #looking for the default wall which is in session, we can't see it result = wall_list() #result = (function above that returns dictionary with 2 key:value pairs) result["result"] = "Message Received" # the value of key result (OK) with "Message Recieved" #print result return result #return dictionary {"result : "Message Received", "messages": "...."},
def enter_contest(cid): contest = Contest.query.get_or_404(cid) form = EnterContestForm() if form.validate_on_submit(): if contest.verify_passcode(form.passcode.data): session.setdefault('contests', []).append(contest.id) return redirect(url_for('oj.contest', id=contest.id)) else: form.errors.setdefault('passcode', []).append('Passcode incorrect.') return render_template('enter_contest.html', form = form, contest = contest)
def get_check(self, text): """查看验证码是否正确""" session.setdefault("captcha_success", False) captcha = session.get("captcha_text") success = bool(captcha is not None and captcha.lower() == text.lower()) session["captcha_success"] = success return { "text": text, "success": success }
def _getAnswer(self): # We don't overwrite a previous entry - the original (admin) user should be kept there session.setdefault('login_as_orig_user', { 'timezone': session.timezone, 'user_id': session.user.id, 'user_name': session.user.get_full_name(last_name_first=False, last_name_upper=False) }) session.user = self._user session.timezone = timezoneUtils.SessionTZ(self._user.as_avatar).getSessionTZ() return True
def add_to_cart(id): """Add a melon to cart and redirect to shopping cart page. When a melon is added to the cart, redirect browser to the shopping cart page and display a confirmation message: 'Successfully added to cart'. """ session.setdefault('cart', []).append(id) flash("Melon successfully added") return redirect("/cart")
def _getAnswer(self): # We don't overwrite a previous entry - the original (admin) user should be kept there session.setdefault('login_as_orig_user', { 'session_data': {k: session.pop(k) for k in session.keys() if k[0] != '_' or k in {'_timezone', '_lang'}}, 'user_id': session.user.id, 'user_name': session.user.get_full_name(last_name_first=False, last_name_upper=False) }) session.user = self._user session.lang = session.user.settings.get('lang') session.timezone = timezoneUtils.SessionTZ(self._user.as_avatar).getSessionTZ() return True
def before_request(): if not g.user: if 'user_id' in session: session.setdefault('reboot_required', set()) g.user = User.query.get(session['user_id']) if not g.user or g.user.deleted: g.user = None session.permanent = True if g.user and not session.get('_csrf_token'): session['_csrf_token'] = util.random_string()
def _getAnswer(self): tzUtil = timezoneUtils.SessionTZ(self._av) tz = tzUtil.getSessionTZ() # We don't overwrite a previous entry - the original (admin) user should be kept there session.setdefault('login_as_orig_user', { 'timezone': session.timezone, 'user_id': session.user.getId(), 'user_name': session.user.getStraightAbrName() }) session.user = self._av session.timezone = tz return True
def add_to_cart(id): """Add a melon to cart and redirect to shopping cart page. When a melon is added to the cart, redirect browser to the shopping cart page and display a confirmation message: 'Successfully added to cart'. """ # TODO: Finish shopping cart functionality # - use session variables to hold cart list session.setdefault('cart', []).append(id) flash("Melon added to cart.") return redirect("/cart")
def get_user_settings(c, ip): q = UserConfigurations.query.filter_by(ip=ip).first() gamerooms = GameRooms.query.order_by('active').all()[-10:] for x, y in DEFAULT_VALUE.items(): if q is None: c[x] = y else: c[x] = q.__dict__[x] if x == 'nickname': session['nickname'] = q.__dict__[x] session.setdefault('nickname', DEFAULT_VALUE['nickname']) c['gamerooms'] = gamerooms return get_context(c)
def add_to_cart(): """TODO: Finish shopping cart functionality using session variables to hold cart list. Intended behavior: when a melon is added to a cart, redirect them to the shopping cart page, while displaying the message "Successfully added to cart" """ id = int(request.form.get("id")) session.setdefault("cart", []).append(id) flash("Melon successfully added to cart") return redirect("/cart")
def fractal_game(): symbol = choice(symbols) series_spacing = choice(series_spacings) days_range = series_length*series_spacing*2 max_start_date = (end_date - timedelta(days_range)).date() start_date = DailyStockPrice.query.filter_by(symbol=symbol).filter(DailyStockPrice.date < max_start_date).order_by(func.random()).first().date.strftime(date_format) session.setdefault('guesses',0) session.setdefault('guesses_correct',0) #print url_for('get_data',symbol=symbol,start_date=start_date,series_spacing=series_spacing) return render_template('random.html', symbol=symbol, series_spacing=series_spacing, start_date=start_date)
def share(temphash): if session.get('username'): result = process_share(session.get('username'), temphash, True, app.db) if result: return redirect( "/docview/%s/%s" % (result['mode'], result['docid']) ) else: return redirect("/login") else: session.setdefault('sharelinks', []).append(temphash) return render_template("loginorregister.html", debug=app.debug)
def add_to_cart(id): """Add a melon to cart and redirect to shopping cart page. When a melon is added to the cart, redirect browser to the shopping cart page and display a confirmation message: 'Successfully added to cart'. """ # - add the id of the melon they bought to the cart in the session session.setdefault('cart_items', []).append(id) melon = melons.get_by_id(id) #Flash a message indicating the melon was successfully added to the cart. flash(melon.common_name + " was added to cart") return redirect("/cart")
def add_to_cart(id): session.setdefault('shopping_cart', []).append(id) melon = model.get_melon_by_id(id) """TODO: Finish shopping cart functionality using session variables to hold cart list. Intended behavior: when a melon is added to a cart, redirect them to the shopping cart page, while displaying the message "Successfully added to cart" """ flash(Markup("Successfully added to <a href='/cart'>cart</a>")) # return render_template("cart.html") return render_template("melon_details.html", display_melon = melon)
def add_to_cart(id): """Add a melon to cart and redirect to shopping cart page. When a melon is added to the cart, redirect browser to the shopping cart page and display a confirmation message: 'Successfully added to cart'. """ #make the cart, where cart = [] #append the cart with melon ids session.setdefault('cart', []).append(id) #check out setDefault to check if keys in cart flash("Melon was successfully added to cart") return render_template("cart.html", melons_list = melons)
def add_to_cart(id): """Add a melon to cart and redirect to shopping cart page. When a melon is added to the cart, redirect browser to the shopping cart page and display a confirmation message: 'Successfully added to cart'. """ session.setdefault('cart', []).append(id) # TODO: Finish shopping cart functionality # The logic here should be something like: # # - add the id of the melon they bought to the cart in the session flash("The melon was successfully added to the cart!") return redirect("/cart")
def shopping_cart(): """TODO: Display the contents of the shopping cart. The shopping cart is a list held in the session that contains all the melons to be added. Check accompanying screenshots for details.""" melons = [ (model.get_melon_by_id(int(id)), count) for id, count in session.setdefault("cart", {}).items() ] total = sum([melon[0].price * melon[1] for melon in melons]) return render_template("cart.html", melons = melons, total=total)
def setup_tokens(): session.setdefault('tokens', [])
def stats(): stats = session.setdefault('stats', {}) by_count = [(v, k) for k, v in stats.items()] return render_template('stats.html', stats=by_count)
def show_cart(): melons = [(model.get_melon_by_id(int(id)), count) for id, count in session.setdefault("cart", {}).items()] total = sum([melon[0].price * melon[1] for melon in melons]) return render_template("_cart_items.html", melons=melons, total=total)
def create_your_account_complete(): email_address = session.setdefault("email_sent_to", "the email address you supplied") return render_template("create_buyer/create_your_account_complete.html", email_address=email_address), 200
def session_set(key, data): session.setdefault('abilian_setup', {})[key] = data
def initiate_external_login(self): token = session.setdefault(self._session_key, str(uuid4())) return self.oauth_app.authorize(callback=self._get_redirect_uri(), state=token)
def dispatch_request(self): session.setdefault('siginin_code', str(uuid.uuid4())) return json.dumps({ 'signin_code': session.get('siginin_code') })
def combined_from_session() -> hack.CombinedPatient: return session.setdefault('combined_patient', hack.CombinedPatient())
def index(): session.setdefault('foo', 'baz') return Response(session['foo'])
def session_setdefault(self, name, value): return session.setdefault(name, value)
def get_username() -> str: if "username" in session: return session.setdefault("hsds_user", session["username"]) else: return init_session_from_environment()
def _make_key(self, value: str): uid = session.setdefault(self.session_key, uuid.uuid4()) return self.hasher(value=value.encode(), uid=uid.bytes)
def load_table(): """Get JSON data for the Holdingpen table. Function used for the passing of JSON data to DataTables: 1. First checks for what record version to show 2. Then the sorting direction. 3. Then if the user searched for something. :return: JSON formatted str from dict of DataTables args. """ tags = session.setdefault( "holdingpen_tags", [ObjectVersion.name_from_version(ObjectVersion.HALTED)] ) if request.method == "POST": if request.json and "tags" in request.json: tags = request.json["tags"] session["holdingpen_tags"] = tags # This POST came from tags-input. # We return here as DataTables will call a GET here after. return None i_sortcol_0 = int( request.args.get('iSortCol_0', session.get('holdingpen_iSortCol_0', 4)) ) s_sortdir_0 = request.args.get('sSortDir_0', session.get('holdingpen_sSortDir_0', "desc")) session["holdingpen_iDisplayStart"] = int(request.args.get( 'iDisplayStart', session.get('iDisplayLength', 10)) ) session["holdingpen_iDisplayLength"] = int( request.args.get('iDisplayLength', session.get('iDisplayLength', 0)) ) session["holdingpen_sEcho"] = int( request.args.get('sEcho', session.get('sEcho', 0)) ) + 1 bwobject_list = get_holdingpen_objects(tags) bwobject_list = sort_bwolist(bwobject_list, i_sortcol_0, s_sortdir_0) session["holdingpen_iSortCol_0"] = i_sortcol_0 session["holdingpen_sSortDir_0"] = s_sortdir_0 table_data = {'aaData': [], 'iTotalRecords': len(bwobject_list), 'iTotalDisplayRecords': len(bwobject_list), 'sEcho': session["holdingpen_sEcho"]} # Add current ids in table for use by previous/next record_ids = [o.id for o in bwobject_list] session['holdingpen_current_ids'] = record_ids records_showing = 0 display_start = session["holdingpen_iDisplayStart"] display_end = display_start + session["holdingpen_iDisplayLength"] for bwo in bwobject_list[display_start:display_end]: records_showing += 1 action_name = bwo.get_action() action_message = bwo.get_action_message() if not action_message: action_message = "" preformatted = get_formatted_holdingpen_object(bwo) action = actions.get(action_name, None) mini_action = None if action: mini_action = getattr(action, "render_mini", None) extra_data = bwo.get_extra_data() record = bwo.get_data() if not hasattr(record, "get"): try: record = dict(record) except (ValueError, TypeError): record = {} bwo._class = HOLDINGPEN_WORKFLOW_STATES[bwo.version]["class"] bwo.message = HOLDINGPEN_WORKFLOW_STATES[bwo.version]["message"] row = render_template('workflows/row_formatter.html', title=preformatted["title"], object=bwo, record=record, extra_data=extra_data, description=preformatted["description"], action=action, mini_action=mini_action, action_message=action_message, pretty_date=pretty_date, version=ObjectVersion, ) row = row.split("<!--sep-->") table_data['aaData'].append(row) return jsonify(table_data)
def gateway_login(): gw_2fa = session.get('gw_2fa') gateway_saml = session.get('gateway_saml') inputStr = request.form.get('inputStr') or None if session.get('portal_cookie') and request.form.get( session['portal_cookie']) == session.get(session['portal_cookie']): # a correct portal_cookie explicitly allows us to bypass other gateway login forms pass elif gw_2fa and not inputStr: return challenge_2fa('gateway') else: okay = False if gateway_saml and request.form.get('user') and request.form.get( gateway_saml): okay = True elif request.form.get('user') and request.form.get( 'passwd') and inputStr == session.get('inputStr'): okay = True if not okay: return 'Invalid username or password', 512 session.update( step='gateway-login', user=request.form.get('user'), passwd=request.form.get('passwd'), # clear inputStr to ensure failure if same form fields are blindly retried on another challenge form: inputStr=None) for k, v in (('jnlpReady', 'jnlpReady'), ('ok', 'Login'), ('direct', 'yes'), ('clientVer', '4100'), ('prot', 'https:')): if request.form.get(k) != v: abort(500) for k in ('clientos', 'os-version', 'server', 'computer'): if not request.form.get(k): abort(500) portal = 'Portal%d' % randint(1, 10) auth = 'Auth%d' % randint(1, 10) domain = 'Domain%d' % randint(1, 10) preferred_ip = request.form.get( 'preferred-ip') or '192.168.%d.%d' % (randint(2, 254), randint(2, 254)) if request.form.get('ipv6-support') == 'yes': preferred_ipv6 = request.form.get( 'preferred-ipv6') or 'fd00::%x' % randint(0x1000, 0xffff) else: preferred_ipv6 = None session.update(preferred_ip=preferred_ip, portal=portal, auth=auth, domain=domain, computer=request.form.get('computer'), ipv6_support=request.form.get('ipv6-support'), preferred_ipv6=preferred_ipv6) session.setdefault('portal-prelogonuserauthcookie', '') session.setdefault('portal-userauthcookie', '') session['authcookie'] = cookify(dict(session)).decode() return '''<?xml version="1.0" encoding="utf-8"?> <jnlp> <application-desc> <argument>(null)</argument> <argument>{authcookie}</argument> <argument>PersistentCookie</argument> <argument>{portal}</argument> <argument>{user}</argument> <argument>TestAuth</argument> <argument>vsys1</argument> <argument>{domain}</argument> <argument>(null)</argument> <argument/> <argument></argument> <argument></argument> <argument>tunnel</argument> <argument>-1</argument> <argument>4100</argument> <argument>{preferred_ip}</argument> <argument>{portal-userauthcookie}</argument> <argument>{portal-prelogonuserauthcookie}</argument> <argument>{ipv6}</argument> </application-desc></jnlp>'''.format(ipv6=preferred_ipv6 or '', **session)
def setup_session(): session.setdefault("logged_in", False) session.setdefault("user_id", None)
def startup(): session.permanent = False app.permanent_session_lifetime = datetime.timedelta(minutes=10) session.setdefault('username', None) session.setdefault('kleurcode', '2196f3')
def book(book_id): """Show individual book pages.""" # find book in library db book = db.execute("SELECT * FROM library WHERE id = :id", {"id" : book_id}).fetchone() # if user submits a review via the form if request.method == "POST": # get review details rating = request.form.get("star") comment = request.form.get("comment") # verify if user has made a review for this book already check = db.execute("SELECT * from reviews WHERE user_id = :user_id AND book_id = :book_id", {"user_id" : session["user_id"], "book_id" : book_id}).fetchone() if check: flash("Sorry. You have reviewed this book already. 💔") return redirect(url_for("book",book_id=book_id)) # add review to database db.execute("INSERT INTO reviews (rating, review_text, user_id, book_id) VALUES (:rating, :review_text, :user_id, :book_id)", {"rating" : rating, "review_text" : comment, "user_id" : session["user_id"], "book_id" : book_id}) db.commit() # add book to session["reviewed"] book = (book_id, book.title, book.year) session.setdefault("reviews",[]).append(book) flash("Awesome! Your review has been added. ❤️") return redirect(url_for("book", book_id=book_id)) # user reaches route via GET else: if book is None or len(book) == 0: return redirect(url_for("search")) # get Goodreads data res = requests.get("https://www.goodreads.com/book/review_counts.json", params={"key": os.getenv("GOODREADS_KEY"), "isbns": book.isbn}) # Goodreads API data goodreads = res.json()['books'][0] avg_rating = goodreads['average_rating'] rev_count = goodreads['work_ratings_count'] # get plot & thumbnail from Google Books API req = "https://www.googleapis.com/books/v1/volumes?q=title+inauthor:byauthor" req = req.replace("title", book.title) req = req.replace("byauthor", book.author) googleAPI = requests.get(req).json()["items"][0]["volumeInfo"] plot = googleAPI["description"] thumbnail = "" try: thumbnail = googleAPI["imageLinks"]["thumbnail"].replace("zoom=1", "zoom=3") except: thumbnail = "http://covers.openlibrary.org/b/isbn/"f'{book.isbn}'"-L.jpg" # query back BooksDB API to get review scores booksDB = requests.get("https://books4cs50w.herokuapp.com/api/"f'{book.isbn}'"").json() ave_score = booksDB["average_score"] ave_count = int(booksDB["review_count"]) # get user reviews from db reviews = db.execute("SELECT username, date_posted, rating, review_text FROM reviews JOIN users ON users.id = reviews.user_id WHERE book_id = :book_id ORDER BY date_posted DESC", {"book_id" : book_id}).fetchall() # track user browsing history if session.get("history") is None: session.setdefault("history",[]).append({book.title : book.id}) elif {book.title : book.id} in session["history"]: pass else: session.setdefault("history",[]).append({book.title : book.id}) return render_template("book.html", book=book, rating=avg_rating, count=rev_count, plot=plot, thumbnail=thumbnail, reviews=reviews, ave_score = ave_score, ave_count = ave_count)
def _process(self): access_keys = session.setdefault('accessKeys', {}) access_keys[self._target.getOwner().getUniqueId()] = self._accesskey session.modified = True self._redirect(urlHandlers.UHFileAccess.getURL(self._target))
def inner(*args, **kwargs): session.setdefault('cart', {}) return func(*args, **kwargs)
def _process(self): access_keys = session.setdefault('accessKeys', {}) access_keys[self._target.getUniqueId()] = self._accesskey session.modified = True self._redirect(urlHandlers.UHMaterialDisplay.getURL(self._target))
def get_items(): items = session.setdefault('items', default_items) return jsonify(items)
def _process(self): access_keys = session.setdefault("accessKeys", {}) access_keys[self._conf.getUniqueId()] = self._accesskey session.modified = True url = urlHandlers.UHConferenceDisplay.getURL(self._conf) self._redirect(url)
def index(): session.setdefault('gold', 0) session.setdefault('activity', []) return render_template("index.html")
def save_submitted_survey_to_session(submission): """Save submission of a survey to session for further checks""" session.setdefault('submitted_surveys', {})[submission.survey.id] = submission.id session.modified = True
def session_get(key, default=None): return session.setdefault('abilian_setup', {}).get(key, default)
def heartbeat(): session.setdefault('id', str(uuid.uuid4())) gevent.sleep(10) clientid = request.headers.get('WS-Clientid') print clientid return 'success'