def korean(): """ Switch user language to Korean """ try: current_user.data['lang'] = 'kor' current_user.update_db() except: app.logger.info('ERROR: Exception while switching to Korean') return redirect(url_for('index'))
def english(): """ Switch user language to English """ try: current_user.data['lang'] = 'eng' current_user.update_db() except: app.logger.info('ERROR: Exception while switching to English') return redirect(url_for('index'))
def japanese(): """ Switch user language to Japanese """ try: current_user.data['lang'] = 'japanese' current_user.update_db() except: app.logger.info('ERROR: Exception while switching to Japanese') return redirect(url_for('index'))
def account(): UpdateAccountForm.translate() form = UpdateAccountForm() if form.validate_on_submit(): current_user.data['fname'] = form.fname.data.strip().strip() current_user.data['lname'] = form.lname.data.strip().strip() current_user.update_db() flash(tr('account_updated'), 'success') return redirect(url_for('account')) elif request.method == 'GET': form.username.data = current_user.data['username'] form.email.data = current_user.data['email'] form.fname.data = current_user.data['fname'] form.lname.data = current_user.data['lname'] return render_template('account.tmpl', title='Account', form=form)
def create_game(): """ Create a new game in the database """ try: data = request.json data.update({'username': current_user.data['username']}) game = dbmodel.Game() # Store user IP with the game if request.headers.getlist("X-Forwarded-For"): ip = request.headers.getlist("X-Forwarded-For")[0] else: ip = request.remote_addr data.update({'ip_addr': ip}) game.update_db(data) current_user.data['game_hash'] = game.id current_user.update_db() return jsonify({'game_hash': game.id}) except: app.logger.info('ERROR: Exception in create_game()') return redirect(url_for('index'))
def korean(): current_user.data['lang'] = 'kor' current_user.update_db() return redirect(url_for('index'))
def english(): current_user.data['lang'] = 'eng' current_user.update_db() return redirect(url_for('index'))