Ignore:
Timestamp:
Sep 3, 2007, 4:26:45 PM (12 years ago)
Author:
Nick Burch
Message:

Add --verbose flag, and don't report changes to postcodes unless it's set

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/scripts/freethepostcode.org-importer/importer.py

    r576 r577  
    2424
    2525# What arguments did they pass in?
     26verbose = False
    2627download = False
    2728confirm_update = True
    2829for arg in sys.argv[1:]:
     30        if arg == "--verbose":
     31                verbose = True
    2932        if arg == "--download":
    3033                download = True
     
    189192for postcode in postcodes:
    190193        pc = "%s %s" % (postcode["outer"], postcode["inner"])
    191         print "Processing %s" % pc
     194        if verbose:
     195                print "Processing %s" % pc
    192196
    193197        if ftps.has_key(pc):
     
    195199                ftps[pc]['done'] = True
    196200                sth.execute(upd_sql, (postcode["outer"], postcode["inner"], postcode["raw_outer"], postcode["raw_inner"], postcode["easting"], postcode["northing"], postcode["ie_easting"], postcode["ie_northing"], ftps[pc]['id']))
    197                 print "\tupdated record at %d" % ftps[pc]['id']
     201                if verbose:
     202                        print "\tupdated record at %d" % ftps[pc]['id']
    198203        else:
    199204                # New record, add
    200205                sth.execute(add_sql, (postcode["outer"], postcode["inner"], postcode["raw_outer"], postcode["raw_inner"], postcode["easting"], postcode["northing"], postcode["ie_easting"], postcode["ie_northing"], ftp_source))
    201                 print "\tadded new postcode"
     206                if verbose:
     207                        print "\tadded new postcode"
     208                else:
     209                        print "Added postcode %s" % pc
    202210        worked = worked + 1
    203211
Note: See TracChangeset for help on using the changeset viewer.