Skip to content

Commit

Permalink
Merge branch '0.9-maintenance'
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Aug 5, 2013
2 parents a85fe30 + 3dcc5a5 commit cf53f37
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions examples/contrib/sessions.py
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 cf53f37

Please sign in to comment.