raise NotFound("You haven't taken this survey") # TODO: replace with a proper exception/error message return answer.index_html(REQUEST=REQUEST) security.declareProtected(view_management_screens, 'manage_migrate') def manage_migrate(self, REQUEST, widget_id, convert_to): """ convert widget type """ perform_migration(self, widget_id, convert_to) self.setSessionInfo(["Changed widget type for %r" % widget_id]) REQUEST.RESPONSE.redirect(self.absolute_url() + '/manage_migrate_html') security.declareProtected(view_management_screens, 'manage_migrate_html') manage_migrate_html = PageTemplateFile('zpt/questionnaire_manage_migrate', globals()) manage_migrate_html.available_migrations = available_migrations security.declareProtected('View management screens', 'manage_update_combo_answers_html') def manage_update_combo_answers_html(self, REQUEST=None): """ Update answer to questions based on combos for the case when the first option was not initially entered as 'Please select'""" if 'question_id' not in REQUEST.form: return self._manage_update_combo_answers_html() question_id = REQUEST.get('question_id') errors = [] question_ids = [question.id for question in self.objectValues('Naaya Combobox Widget')] + \
return answer.index_html(REQUEST=REQUEST) # # macros & other html snippets # security.declareProtected(view, "base_index_html") base_index_html = NaayaPageTemplateFile( "zpt/base_questionnaire_index", globals(), "NaayaSurvey.base_questionnaire_index" ) security.declareProtected(view, "showCaptcha") def showCaptcha(self): """Return HTML code for CAPTCHA""" return recaptcha_utils.render_captcha(self) security.declareProtected(view_management_screens, "manage_migrate") def manage_migrate(self, REQUEST, widget_id, convert_to): """ convert widget type """ perform_migration(self, widget_id, convert_to) self.setSessionInfo(["Changed widget type for %r" % widget_id]) REQUEST.RESPONSE.redirect(self.absolute_url() + "/manage_migrate_html") security.declareProtected(view_management_screens, "manage_migrate_html") manage_migrate_html = PageTemplateFile("zpt/questionnaire_manage_migrate", globals()) manage_migrate_html.available_migrations = available_migrations InitializeClass(SurveyQuestionnaire)