Use self.send_error(401,..) instead of raising an exception in certain cases.

pull/7/head
Ferry Boender 9 years ago
parent 05a3d30024
commit ddf5464ade
  1. 6
      src/scriptform.py

@ -669,7 +669,8 @@ class ScriptFormWebApp(WebAppHandler):
form_def = form_config.get_form(form_name)
if form_def.allowed_users is not None and \
self.username not in form_def.allowed_users:
raise Exception("Not authorized")
self.send_error(401, "You're not authorized to view this form")
return
html_errors = ''
if errors:
@ -702,7 +703,8 @@ class ScriptFormWebApp(WebAppHandler):
form_def = form_config.get_form(form_name)
if form_def.allowed_users is not None and \
self.username not in form_def.allowed_users:
raise Exception("Not authorized")
self.send_error(401, "You're not authorized to view this form")
return
# Convert FieldStorage to a simple dict, because we're not allowd to
# add items to it. For normal fields, the form field name becomes the

Loading…
Cancel
Save