def post(self): form = AutoDeleteErrorReportsForm(self.request.arguments) if form.validate(): GlobalSetting.set_value(GlobalSetting.AUTO_DELETE_ERROR_REPORTS, form.enabled.data) self.redirect(self.reverse_url("admin.error_reports")) else: raise HTTPError(400)
def post(self): form = AutoDeleteErrorReportsForm(self.request.arguments) if form.validate(): GlobalSetting.set_value( GlobalSetting.AUTO_DELETE_ERROR_REPORTS, form.enabled.data ) self.redirect(self.reverse_url('admin.error_reports')) else: raise HTTPError(400)
def clean_error_reports(): if self.is_maintenance_in_progress(): return enabled = GlobalSetting.get_value( GlobalSetting.AUTO_DELETE_ERROR_REPORTS) if enabled: ErrorReport.delete_orphaned()
def get(self): offset_id = int(self.get_argument("offset_id", 0)) error_reports = ErrorReport.all_reports(offset_id=offset_id) auto_delete_form = AutoDeleteErrorReportsForm( enabled=GlobalSetting.get_value(GlobalSetting.AUTO_DELETE_ERROR_REPORTS) ) self.render( "admin/overview/error_reports.html", error_reports=error_reports, delete_all_form=DeleteAllErrorReportsForm(), auto_delete_form=auto_delete_form, next_offset_id=error_reports[-1]["id"] if error_reports else 0, count=ErrorReport.get_count(), )
def get(self): project_id=self.get_argument('project_id', None) error_reports = ErrorReport.all_reports( offset_id=int(self.get_argument('offset_id', 0)), project_id=project_id) auto_delete_form = AutoDeleteErrorReportsForm( enabled=GlobalSetting.get_value( GlobalSetting.AUTO_DELETE_ERROR_REPORTS) ) delete_one_form = DeleteOneErrorReportForm() self.render( 'admin/overview/error_reports.html', error_reports=error_reports, delete_all_form=DeleteAllErrorReportsForm(), auto_delete_form=auto_delete_form, next_offset_id=error_reports[-1]['id'] if error_reports else 0, project_id=project_id, count=ErrorReport.get_count() if project_id is None else 0, item_action_form=delete_one_form, )