def simple_app(environ, start_response): session = environ['beaker.session'] if not session.has_key('value'): session['value'] = 0 session['value'] += 1 if not environ['PATH_INFO'].startswith('/nosave'): session.save() start_response('200 OK', [('Content-type', 'text/plain')]) return ['The current value is: %d and cookie is %s' % (session['value'], session)]
def simple_app(environ, start_response): session = environ["beaker.session"] if not session.has_key("value"): session["value"] = 0 session["value"] += 1 if not environ["PATH_INFO"].startswith("/nosave"): session.save() start_response("200 OK", [("Content-type", "text/plain")]) msg = "The current value is: %d and cookie is %s" % (session["value"], session) return [msg.encode("UTF-8")]
def simple_app(environ, start_response): session = environ['beaker.session'] if not session.has_key('value'): session['value'] = 0 session['value'] += 1 domain = environ.get('domain') if domain: session.domain = domain if not environ['PATH_INFO'].startswith('/nosave'): session.save() start_response('200 OK', [('Content-type', 'text/plain')]) msg = 'The current value is: %d and cookie is %s' % (session['value'], session) return [msg.encode('utf-8')]