def _get_or_create_section(self, course, instructors): section_record = Section.query.filter_by(crn=course.crn).first() if not section_record: section_record = Section("Spring 2015", course.crn, course.start_time, course.end_time, course.days, course.enrollment) #print "Adding Section: \"%s\"" % course.crn self.num_new_sections += 1 section_record.instructors = instructors db.session.add(section_record) #db.session.commit() if course.crn not in self.crns: self.num_sections += 1 self.crns[course.crn] = True return section_record