diff --git a/ksweb/ksweb/controllers/questionary.py b/ksweb/ksweb/controllers/questionary.py index ad8b29a5..ad379256 100644 --- a/ksweb/ksweb/controllers/questionary.py +++ b/ksweb/ksweb/controllers/questionary.py @@ -113,7 +113,7 @@ def compile(self, _id, workspace, **kwargs): return dict(questionary=questionary, quest_compiled=questionary.evaluate_questionary, html=self.get_questionary_html(_id), workspace=workspace) - @expose('odt:ksweb.templates.questionary.questionary', content_type='application/vnd.oasis.opendocument.text') + @expose(content_type='text/html') @validate({ '_id': QuestionaryExistValidator(required=True), }, error_handler=validation_errors_response) @@ -121,8 +121,8 @@ def compile(self, _id, workspace, **kwargs): entity_model=model.Questionary)) def download(self, _id): questionary = model.Questionary.query.get(_id=ObjectId(_id)) - response.headerlist.append(('Content-Disposition', 'attachment;filename=%s.odt' % questionary._id)) - return dict(content=self.get_questionary_html(_id).striptags()) + response.headerlist.append(('Content-Disposition', 'attachment;filename=%s.html' % questionary._id)) + return self.get_questionary_html(_id) @staticmethod def get_questionary_html(quest_id): diff --git a/ksweb/ksweb/tests/functional/test_questionary.py b/ksweb/ksweb/tests/functional/test_questionary.py index 162bf5dc..ed8894d1 100644 --- a/ksweb/ksweb/tests/functional/test_questionary.py +++ b/ksweb/ksweb/tests/functional/test_questionary.py @@ -249,6 +249,14 @@ def test_compile_advanced_questionary_not_showing_two_time_same_answer(self): assert resp['quest_compiled']['completed'] is True, resp + def test_download(self): + self.test_compile_advanced_questionary() + form = self._get_questionary_by_title('Advanced_Questionary') + response = self.app.get('/questionary/download', params=dict(_id=str(form._id))) + + assert response + assert str(form._id) in response.content_disposition + def test_completed(self): self.test_questionary_create()