Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/rpc.py

    r908 r889  
    208208                      "TU5"  : const.AIRCRAFT_T154,
    209209                      "YK4"  : const.AIRCRAFT_YK40,
    210                       "146"  : const.AIRCRAFT_B462,
    211                       "IL6"  : const.AIRCRAFT_IL62 }
     210                      "146"  : const.AIRCRAFT_B462 }
    212211
    213212    # FIXME: copied from web.BookedFlight
     
    229228                      const.AIRCRAFT_T154  : "TU5",
    230229                      const.AIRCRAFT_YK40  : "YK4",
    231                       const.AIRCRAFT_B462  : "146",
    232                       const.AIRCRAFT_IL62  : "IL6" }
     230                      const.AIRCRAFT_B462  : "146" }
    233231
    234232    # FIXME: copied from web.BookedFlight
     
    236234    def _decodeAircraftType(typeCode):
    237235        """Decode the aircraft type from the given typeCode."""
    238         if typeCode in const.icao2Type:
    239             return const.icao2Type[typeCode]
     236        if typeCode in BookedFlight.TYPECODE2TYPE:
     237            return BookedFlight.TYPECODE2TYPE[typeCode]
    240238        else:
    241239            raise Exception("Invalid aircraft type code: '" + typeCode + "'")
     
    277275    _instructions = {
    278276        "numPassengers" : int,
    279         "numCockpitCrew" : int,
    280         "numCabinCrew" : int,
     277        "numCrew" : int,
    281278        "bagWeight" : int,
    282279        "cargoWeight" : int,
     
    310307        print >> f, "tail_nr=%s" % (self.tailNumber,)
    311308        print >> f, "passenger=%d" % (self.numPassengers,)
    312         print >> f, "crew=%d" % (self.numCockpitrew + self.numCabinCrew,)
     309        print >> f, "crew=%d" % (self.numCrew,)
    313310        print >> f, "bag=%d" % (self.bagWeight,)
    314311        print >> f, "cargo=%d" % (self.cargoWeight,)
     
    379376        for planeValue in value:
    380377            self._addPlane(Plane(planeValue))
    381 
    382 #---------------------------------------------------------------------------------------
    383 
    384 class AircraftTypeInfo(RPCObject):
    385     """Information about an aircraft type."""
    386     # The instructions for the construction
    387     _instructions = {
    388         "dow" : int,
    389         "dowCockpit" : int,
    390         "dowCabin" : int,
    391         }
    392 
    393     def __init__(self, value):
    394         """Construct the booked flight object from the given RPC result
    395         value."""
    396         super(AircraftTypeInfo, self).__init__(value,
    397                                                AircraftTypeInfo._instructions)
    398         self.aircraftType = const.icao2Type[value["typeCode"]]
    399378
    400379#---------------------------------------------------------------------------------------
     
    519498            self._sessionID = reply.value["sessionID"]
    520499
    521             types = [const.icao2Type[typeCode]
     500            types = [BookedFlight.TYPECODE2TYPE[typeCode]
    522501                     for typeCode in reply.value["typeCodes"]]
    523502
     
    525504        else:
    526505            return None
    527 
    528     def getTypes(self):
    529         """Get the data of the aircraft types supported by us."""
    530         value = self._performCall(lambda sessionID:
    531                                   self._server.getTypes(sessionID))
    532 
    533         return [AircraftTypeInfo(t) for t in value]
    534506
    535507    def getFlights(self):
     
    627599        of type codes, if any."""
    628600        typeCodes = None if types is None else \
    629           [const.icaoCodes[type] for type in types]
     601            [BookedFlight.TYPE2TYPECODE[type] for type in types]
    630602
    631603        values = self._performCall(lambda sessionID:
Note: See TracChangeset for help on using the changeset viewer.