summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2018-02-13 15:44:36 +0530
committerMartin Trigaux <mat@odoo.com>2018-02-13 15:56:01 +0530
commitca0875231ff5f5b308f2c901e78e34af7d7c8bf2 (patch)
tree49d961f6adbe3bdb06db05c4371cce624a278fdf
parent169f899e291520411ce539f10c8b6b9b7d681c3f (diff)
[FIX] survey: properly detect wrong token
Was in old API user_input_obj.search(...)[0] but the tr/except was not migrated Introduced at 66cb880
-rw-r--r--addons/survey/controllers/main.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/addons/survey/controllers/main.py b/addons/survey/controllers/main.py
index e73e8387426..d7d8392642b 100644
--- a/addons/survey/controllers/main.py
+++ b/addons/survey/controllers/main.py
@@ -109,9 +109,8 @@ class WebsiteSurvey(http.Controller):
return errpage
# Load the user_input
- try:
- user_input = UserInput.sudo().search([('token', '=', token)], limit=1)
- except IndexError: # Invalid token
+ user_input = UserInput.sudo().search([('token', '=', token)], limit=1)
+ if not user_input: # Invalid token
return request.render("website.403")
# Do not display expired survey (even if some pages have already been