[FIX] avoid crash when there is 0 pages for surveys

bzr revid: rim@openerp.com-20140410143018-yk0xvelpiuh8bau2
This commit is contained in:
Richard Mathot (OpenERP) 2014-04-10 16:30:18 +02:00
parent ea69de5114
commit 53ad31c18f
2 changed files with 18 additions and 0 deletions

View File

@ -52,6 +52,10 @@ class WebsiteSurvey(http.Controller):
if survey.stage_id.closed:
return request.website.render("survey.notopen")
# If there is no pages
if not survey.page_ids:
return request.website.render("survey.nopages")
# Everything seems to be ok
return None

View File

@ -31,6 +31,20 @@
</t>
</template>
<!-- Message when the survey has no pages -->
<template id="nopages" name="Survey has no pages">
<t t-call="website.layout">
<div class="wrap">
<div class="container">
<div class="jumbotron mt32">
<h1>Not ready</h1>
<p>This survey has no pages by now!</p>
</div>
</div>
</div>
</t>
</template>
<!-- First page of a survey -->
<template id="survey_init" name="Survey">
<t t-call="website.layout">