[REF] survey: clean useless .decode('utf-8') calls
This commit cleans some useless .decode('utf-8') calls when we return rendered
templates results in the survey controllers.
The http module is capable of handling that type of results and the calls were
not necessary / added complexity.
Task '2187328'
closes odoo/odoo#44540
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -329,8 +329,8 @@ class Survey(http.Controller):
|
||||
and send back this html to the survey_form widget that will inject it into the page."""
|
||||
data = self._prepare_survey_data(survey_sudo, answer_sudo, **post)
|
||||
if answer_sudo.state == 'done':
|
||||
return request.env.ref('survey.survey_fill_form_done').render(data).decode('UTF-8')
|
||||
return request.env.ref('survey.survey_fill_form_in_progress').render(data).decode('UTF-8')
|
||||
return request.env.ref('survey.survey_fill_form_done').render(data)
|
||||
return request.env.ref('survey.survey_fill_form_in_progress').render(data)
|
||||
|
||||
@http.route('/survey/<string:survey_token>/<string:answer_token>', type='http', auth='public', website=True)
|
||||
def survey_display_page(self, survey_token, answer_token, **post):
|
||||
|
||||
@@ -58,7 +58,7 @@ class UserInputSession(http.Controller):
|
||||
survey._session_trigger_next_question()
|
||||
template_values = self._prepare_manage_session_values(survey)
|
||||
template_values['is_rpc_call'] = True
|
||||
return request.env.ref('survey.user_input_session_manage_content').render(template_values).decode('UTF-8')
|
||||
return request.env.ref('survey.user_input_session_manage_content').render(template_values)
|
||||
|
||||
@http.route('/survey/session/results/<string:survey_token>', type='json', auth='user', website=True)
|
||||
def survey_session_results(self, survey_token, **kwargs):
|
||||
@@ -86,7 +86,7 @@ class UserInputSession(http.Controller):
|
||||
'survey': survey,
|
||||
'question': survey.session_question_id,
|
||||
'question_data': question_statistics,
|
||||
}).decode('UTF-8')
|
||||
})
|
||||
|
||||
@http.route('/survey/session/ranking/<string:survey_token>', type='json', auth='user', website=True)
|
||||
def survey_session_ranking(self, survey_token, **kwargs):
|
||||
@@ -104,7 +104,7 @@ class UserInputSession(http.Controller):
|
||||
return request.env.ref('survey.user_input_session_ranking').render({
|
||||
'animate_width': True,
|
||||
'ranking': survey._prepare_ranking_values()
|
||||
}).decode('UTF-8')
|
||||
})
|
||||
|
||||
def _prepare_manage_session_values(self, survey):
|
||||
is_last_question = False
|
||||
|
||||
Reference in New Issue
Block a user