def multisubmitform(self): request = get_request() submit1 = widget.SubmitWidget('sub_a', value='sub_a') submit2 = widget.SubmitWidget('sub_b', value='sub_b') s = "" if request.form: used = False if submit1.parse(request): used = True s += "used_sub_a" if submit2.parse(request): used = True s += "used_sub_b" if not used: assert 0 # print out the referer, too. referer = request.environ.get('HTTP_REFERER') if referer: s += "<p>referer: %s" % (referer, ) return "<form method=POST>%s %s %s</form>" % (s, submit1.render(), submit2.render())
def login(self): request = get_request() username_widget = widget.StringWidget(name='username', value='') submit_widget = widget.SubmitWidget(name='submit', value='submit me') submit_widget2 = widget.SubmitWidget(name='nosubmit2', value="don't submit") if request.form: assert not submit_widget2.parse(request) username = username_widget.parse(request) if username: session = get_session() session.set_user(username) return redirect('./') image_submit = '''<input type=image name='submit you' src=DNE.gif>''' return "<form method=POST>Log in: %s<p>%s<p>%s<p>%s</form>" % \ (username_widget.render(), submit_widget2.render(), submit_widget.render(), image_submit)