def verify(self): """ Verify that the Translation has at least the required keys, lat and lon are correct """ # TODO: verify languages if self.table_name is None: raise MissingKeyError("table_name") if self.field_name is None: raise MissingKeyError("field_name") if self.language is None: raise MissingKeyError("language") if self.translation is None: raise MissingKeyError("translation") if self.table_name not in ENUM_TABLE_NAME: raise InvalidValueError("table_name") if self.record_id is not None and self.table_name == "feed_info": raise InvalidValueError("record_id: forbidden for feed_info") if self.record_id is not None and self.field_value is not None: raise InvalidValueError( "record_id: forbidden if field_value is set") if self.record_id is None and self.field_value is None: raise MissingKeyError( "record_id: required if field_value is not set") if self.record_sub_id is None and (self.table_name == "stop_times" and self.record_id is not None): raise MissingKeyError( "record_sub_id: required if" " table_name equals stop_times and record_id is set") if (self.record_sub_id is not None and self.table_name != "stop_times"): raise InvalidValueError( "record_sub_id: only allowed for stop_times") if self.field_value is not None and self.table_name == "feed_info": raise InvalidValueError("field_value: forbidden for feed_info") return True