def handle_assessment_post(sender, objects=None, sources=None, service=None): """Applies custom attribute definitions and maps people roles. Applicable when generating Assessment with template. Args: sender: A class of Resource handling the POST request. objects: A list of model instances created from the POSTed JSON. sources: A list of original POSTed JSON dictionaries. """ del sender, service # Unused db.session.flush() for assessment, src in itertools.izip(objects, sources): _handle_assessment(assessment, src) # Flush roles objects for generated assessments. db.session.flush() for assessment, src in itertools.izip(objects, sources): # Handling IssueTracker info here rather than in hooks/issue_tracker # would avoid querying same data (such as snapshots, audits and # templates) twice. issue_tracker.handle_assessment_create(assessment, src)