def _do_save(self, req, id): """Save report changes to the database""" req.perm(self.realm, id).require('REPORT_MODIFY') if 'cancel' not in req.args: report = Report(self.env, id) report.title = req.args.get('title', '') report.query = req.args.get('query', '') report.description = req.args.get('description', '') report.update() add_notice(req, _("Your changes have been saved.")) req.redirect(req.href.report(id))
def _do_create(self, req): req.perm(self.realm).require('REPORT_CREATE') if 'cancel' in req.args: req.redirect(req.href.report()) report = Report(self.env) report.title = req.args.get('title', '') report.query = req.args.get('query', '') report.description = req.args.get('description', '') report.insert() add_notice(req, _("The report has been created.")) req.redirect(req.href.report(report.id))