Changeset 889:5f3b3d4a9957 for src


Ignore:
Timestamp:
09/27/17 19:00:19 (7 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

An RPC-originated booked flight can be saved too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/rpc.py

    r859 r889  
    295295            self.arrivalTime += datetime.timedelta(days = 1)
    296296
     297    def writeIntoFile(self, f):
     298        """Write the flight into a file."""
     299        print >> f, "callsign=%s" % (self.callsign,)
     300        date = self.departureTime.date()
     301        print >> f, "date=%04d-%02d-%0d" % (date.year, date.month, date.day)
     302        print >> f, "dep_airport=%s" % (self.departureICAO,)
     303        print >> f, "dest_airport=%s" % (self.arrivalICAO,)
     304        print >> f, "planecode=%s" % \
     305              (BookedFlight.TYPE2TYPECODE[self.aircraftType],)
     306        print >> f, "planetype=%s" % (self.aircraftTypeName,)
     307        print >> f, "tail_nr=%s" % (self.tailNumber,)
     308        print >> f, "passenger=%d" % (self.numPassengers,)
     309        print >> f, "crew=%d" % (self.numCrew,)
     310        print >> f, "bag=%d" % (self.bagWeight,)
     311        print >> f, "cargo=%d" % (self.cargoWeight,)
     312        print >> f, "mail=%d" % (self.mailWeight,)
     313        print >> f, "flight_route=%s" % (self.route,)
     314        departureTime = self.departureTime
     315        print >> f, "departure_time=%02d\\:%02d\\:%02d" % \
     316              (departureTime.hour, departureTime.minute, departureTime.second)
     317        arrivalTime = self.arrivalTime
     318        print >> f, "arrival_time=%02d\\:%02d\\:%02d" % \
     319              (arrivalTime.hour, arrivalTime.minute, arrivalTime.second)
     320        print >> f, "foglalas_id=%s" % ("0" if self.id is None else self.id,)
     321
    297322#---------------------------------------------------------------------------------------
    298323
Note: See TracChangeset for help on using the changeset viewer.