def get_existing_report_template(self, report_template_id): """ Not for saving, case of just getting, don't want to have optinal saving path here since we expect to error if report doesn't exist etc. """ self.report_template = ReportTemplate.get_by_id(session=self.session, id=report_template_id)
def get_from_id_or_new_report_template(self, report_template_id: int, project=None) -> ReportTemplate: """ Pattern where creating a "new" one really just does the ID and the rest if part of update process? """ if report_template_id: report_template = ReportTemplate.get_by_id(session=self.session, id=report_template_id) if report_template is None: self.log['error'][ 'report_template'] = "Invalid report_template ID" return return report_template else: return ReportTemplate.new(member=self.member, project=project)