def read_unit(cls, name, scholarships=None): '''This method retrieves merges program data from the CIT and CS databases. ''' result = Unit.merge_records( cls.get_cit_data(name), g.mongo.db.programs.find_one({'name': name}) ) if result: # Modify the course hyperlinks to link to our own pages. if 'majorCourses' in result: result['majorCourses'] = \ cls.fix_courses(result['majorCourses']) if 'minorCourses' in result: result['minorCourses'] = \ cls.fix_courses(result['minorCourses']) # Add scholarships regardless of where the program comes from. # Use the scholarships parameter if given, otherwise read them. if scholarships is None: scholarships = Scholarships.read_units() result['scholarships'] = \ cls.get_scholarships(name, scholarships) return result
def read_unit(cls, name): '''This routine find an document with the given nameField.''' return Unit.merge_records( cls.get_cit_scholarship('CPSC', name), g.mongo.db.scholarships.find_one({'name': name}) )