def access_note(note_url): if Note.note_with_url_exists(note_url): note = Note.query.filter(Note.url == note_url).one() return render_template('note.html', text=note.text) else: db.session.add(Note(url=note_url)) db.session.commit() return render_template('note.html')