def setUp(self): self.db_fd, app.config['DATABASE'] = tempfile.mkstemp() self.app = app.test_client() init_db() db_session.add(User('Test User', '*****@*****.**', 'testopenid')) db_session.commit()
def create_profile(): if g.user is not None or 'openid' not in session: return redirect(url_for('home')) if request.method == 'POST': name = request.form['name'] email = request.form['email'] if not name: flash(u'Error: you have to provide a name') elif '@' not in email: flash(u'Error: you have to enter a valid email address') else: flash(u'Profile successfully created') db_session.add(User(name, email, session['openid'])) db_session.commit() return redirect(oid.get_next_url()) return render_template('create_profile.html', next_url=oid.get_next_url())