def update_proposal(vuln: Vulnerability, form: VulnerabilityDetailsForm): vuln.make_reviewable() db.session.add(vuln) db.session.commit() flash("Your proposal was sent for review. You can monitor progress in your Proposals Section.", "success")
def update_proposal(vuln: Vulnerability, form: VulnerabilityDetailsForm): form.populate_obj(vuln) try: new_products = update_products(vuln) except InvalidProducts as ex: flash_error(ex.args[0]) return None with db.session.no_autoflush: changes = vuln.model_changes() # ignore metadata clean_vulnerability_changes(changes) if not changes: flash_error("No changes detected. " "Please modify the entry first to propose a change") return None log.debug("Detected changes: %r", changes) vuln.make_reviewable() db.session.add(vuln) db.session.commit() flash( "Your proposal is in the review queue. " "You can monitor progress in your Proposals Section.", "success", ) return new_products
def update_proposal(vuln: Vulnerability, form: VulnerabilityDetailsForm): form.populate_obj(vuln) vuln.make_reviewable() db.session.add(vuln) db.session.commit() flash( "Your proposal is in the review queue. You can monitor progress in your Proposals Section.", "success")
def update_proposal(vuln: Vulnerability, form: VulnerabilityDetailsForm): form.populate_obj(vuln) try: new_products = update_products(vuln) except InvalidProducts as e: flash_error(e.args[0]) return None with db.session.no_autoflush: changes = vuln.model_changes() # ignore metadata changes.pop('date_modified', None) changes.pop('date_created', None) changes.pop('creator', None) changes.pop('state', None) changes.pop('version', None) changes.pop('prev_version', None) changes.pop('reviewer_id', None) changes.pop('reviewer', None) changes.pop('review_feedback', None) changes.pop('id', None) if not changes: flash_error( "No changes detected. Please modify the entry first to propose a change" ) return None log.debug('Detected changes: %r', changes) vuln.make_reviewable() db.session.add(vuln) db.session.commit() flash( "Your proposal is in the review queue. You can monitor progress in your Proposals Section.", "success") return new_products