def render(name): # TODO: find a better way if name == 'api_request': spac = Spac.get_spac(session['id']) return spac.send_api_key(request.values['email']) from flask import get_template_attribute m = get_template_attribute('render.html', name) result = m(**dict(request.values.iteritems())) return make_response(result)
def api_page(): spac = session.get('id') and Spac.get_spac(session['id']) or None return render_template("api.html", spac=spac)
def withdraw_funds(): spac = Spac.get_spac(session['id']) try: spac.withdraw_funds() except Exception, e: return "Error: could not withdraw funds. (%s)" % e
def profile(): spac = Spac.get_spac(session['id']) return render_template('profile.html', spac=spac)
def login(a): from google.appengine.api import users try: spac = Spac.get_spac(a, must_create=not users.is_current_user_admin()) except Spac.AlreadyExists, e: return "This address is not available, please choose another one."
def spac(a): spac = Spac.get_spac(a, must_exist=True) return render_template("spac.html", spac=spac)
# --accounts @app.route('/login/<a>') def login(a): from google.appengine.api import users try: spac = Spac.get_spac(a, must_create=not users.is_current_user_admin()) except Spac.AlreadyExists, e: return "This address is not available, please choose another one." session['id'] = spac.key().name() session['fund_addr'] = spac.address session['signup_status'] = 'complete' session.permanent = True if 'inviter' in session: inviter = Spac.get_spac(session['inviter']) spac.inviter = inviter spac.put() return redirect(request.values.get("next", "play")) @app.route('/profile') def profile(): spac = Spac.get_spac(session['id']) return render_template('profile.html', spac=spac) @app.route('/invited') def invited(): return render_template('invited.html') @app.route('/verify_invite_code')