Next / Previous / Contents / NM Tech homepage

7.7. staticloader: loadPhysios()

staticloader
# - - -   l o a d P h y s i o s

def loadPhysios ( db ):
    '''Load the table of physiographic strata.

      [ (db is a CBCData instance) and
        (PHYSIOS_FILE names a readable, valid data file for
        the physios table) ->
          db  :=  db with the physios table populated from that file ]
    '''
    #-- 1 --
    # [ inFile  :=  a readable file for PHYSIOS_FILE ]
    inFile = file ( PHYSIOS_FILE )

    #-- 2 --
    # [ db.s  +:=  new physios rows made from the lines of inFile ]
    for rawLine in inFile:
        #-- 2 body --
        # [ rawLine is a valid physios file line ->
        #     db  :=  db with a new physios row made from rawLine ]
        addPhysio ( db, rawLine )

    #-- 3 --
    # [ db  :=  db with the transaction in db.s committed ]
    db.s.commit()