Skip to content

Commit

Permalink
Fixed a broken example. This fixes #419
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Aug 5, 2013
1 parent ba179e7 commit 3dcc5a5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions examples/contrib/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ def get(self, sid):


def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
session = environ['werkzeug.session']
yield '<title>Session Example</title><h1>Session Example</h1>'
if session.new:
session['visit_count'] = 0
yield '<p>This is a new session.</p>'
session['visit_count'] += 1
yield '<p>You visited this page %d times.</p>' % session['visit_count']
session['visit_count'] = session.get('visit_count', 0) + 1

start_response('200 OK', [('Content-Type', 'text/html')])
return ['''
<!doctype html>
<title>Session Example</title>
<h1>Session Example</h1>
<p>You visited this page %d times.</p>
''' % session['visit_count']]


def make_app():
Expand Down

0 comments on commit 3dcc5a5

Please sign in to comment.