def step3_update(self, app, step, action, **params):
     saved_search = SavedSearch.get(params.get('id'))
     saved_search.update(params)
     saved_search.action.rss.enabled = False if params.get('action.rss.enabled') is None else True
     saved_search.action.script.enabled = False if params.get('action.script.enabled') is None else True
     saved_search.action.email.enabled = False if params.get('action.email.enabled') is None else True
     email_results_type = params.get('email_results_type')
     if email_results_type == 'csv':
         saved_search.action.email.format = 'csv'
         saved_search.action.email.sendresults = True
         saved_search.action.email.inline = False
     elif email_results_type == 'inline':
         saved_search.action.email.format = 'html'
         saved_search.action.email.sendresults = True
         saved_search.action.email.inline = True
     elif email_results_type == 'pdf':
         saved_search.action.email.format = None
         saved_search.action.email.sendresults = False
         saved_search.action.email.sendpdf = True
     elif email_results_type == 'raw' or email_results_type == 'plain':
         saved_search.action.email.format = email_results_type
         saved_search.action.email.sendresults = True
         saved_search.action.email.inline = True
     saved_search.alert.track = False if params.get('alert.track') is None else True
     saved_search.is_disabled = False
     has_action = saved_search.action.email.enabled or saved_search.action.rss.enabled or saved_search.action.script.enabled or saved_search.alert.track
     if saved_search.passive_save() and has_action:
         raise cherrypy.HTTPRedirect(self.make_url(['alertswizard', app, 'success'], _qs=dict(id=saved_search.id)), 303)
     pdf_config = PDFConfig.get()
     if has_action is False:
         saved_search.errors.append(_('Please select at least one action'))
     return self.render_template('alertswizard/step3.html', dict(app=app, email_results_type=email_results_type, saved_search=saved_search, pdf_config=pdf_config))
 def step3_edit(self, app, action, **params):
     saved_search = SavedSearch.get(params.get('id'))
     pdf_config = PDFConfig.get()
     email_results_type = None
     if saved_search.action.email.format == 'html':
         saved_search.action.email.format = 'inline'
     elif saved_search.action.email.sendpdf:
         saved_search.action.email.format = 'pdf'
     # first time nudge them not to track if always was selected
     saved_search.alert.track = False if saved_search.alert.type=='always' else True
     return self.render_template('alertswizard/step3.html', dict(app=app, email_results_type=email_results_type, saved_search=saved_search, pdf_config=pdf_config))