コード例 #1
0
    def sortie_test(self, pickled, session):
        selected_set = session.query(Sortie).filter_by(sortie_uuid = pickled.sortie_uuid).all()
        if len(selected_set) < 1:
            print "unknown sortie:%s" % pickled.sortie_uuid

            sortie = Sortie(pickled.installation_uuid)
            sortie.create_time = pickled.get_start_time()
            sortie.name = pickled.band_name
            sortie.sortie_uuid = pickled.sortie_uuid
            sortie.note = pickled.note

            session.add(sortie)
            session.commit()
        else:
            print "known sortie:%s" % pickled.sortie_uuid
コード例 #2
0
    def load_sorties(self, session, sortie_file):
        print 'load sortie'

        infile = open(sortie_file, 'r')
        raw_buffer = infile.readlines()
        infile.close()

        for raw_line in raw_buffer:
            tokens = raw_line.split(',')
            installation_uuid = tokens[0].strip()
            name = tokens[1].strip()
            note = tokens[2].strip()
            sortie_uuid = tokens[3].strip()
            create_time = tokens[4].strip()

            sortie = Sortie(installation_uuid)
            sortie.create_time = create_time
            sortie.name = name
            sortie.note = note
            sortie.sortie_uuid = sortie_uuid
            session.add(sortie)
            session.commit()