def _updatePlane(self, plane, missing): """Try to complete airplane information with information in database Searches for plane in database (by registration). If a match is found, plane is reset to the respective database instance. If no match can be identified, plane is moved to missing. Arguments: plane (:class:`~.db.model.Plane`): Plane instance to update from database missing (:class:`dict`): Dictionary of missing planes """ if not plane.registration: return alias= self.aliases["planes"].get(plane.registration) if alias: plane.registration= alias try: copyMembers( self.db().getPlaneByRegistration(plane.registration), plane ) except KeyError: missing[plane.registration]= plane
def _updatePilot(self, pilot, missing): """Try to complete pilot information with information in database Searches for pilot in database (by first and last name). If a match is found, pilot is reset to the respective database instance. If no match can be identified, pilot is moved to missing. Arguments: pilot (:class:`~.db.model.Pilot`): Pilot instance to update from database missing (:class:`dict`): Dictionary of missing pilots """ if not (pilot.last_name or pilot.first_name): return alias= self.aliases["pilots"].get((pilot.last_name, pilot.first_name)) if alias: pilot.first_name= alias[1] pilot.last_name= alias[0] try: copyMembers( self.db().getPilotByName( pilot.first_name, pilot.last_name ), pilot ) except KeyError: missing[(pilot.last_name, pilot.first_name)]= pilot
def _updateLaunchMethod(self, method, missing): """Try to complete launch method information with information in database Searches for launchMethod in database (by name, short name or type). If a match is found, launchMethod is reset to the respective database instance. If no match can be identified, launchMethod is moved to missing. Arguments: method (:class:`~.db.model.LaunchMethod`): Launch method to update from database missing (:class:`dict`): Dictionary of missing launch methods """ alias= self.aliases["launch methods"].get(method.name) if alias: method.name= alias try: copyMembers( self.db().getLaunchMethodByName(method.name), method ) return except KeyError: pass if method.type == "airtow": try: copyMembers( self.db().getLaunchMethodByTowplane(method.towplane_registration), method ) return except KeyError: pass try: copyMembers( self.db().getLaunchMethodByName("Airtow (other)"), method ) return except KeyError: pass elif method.type == "self": try: copyMembers( self.db().getLaunchMethodByName("Self launch"), method ) return except KeyError: pass missing[method.name]= method