Changeset 576 for trunk


Ignore:
Timestamp:
Sep 1, 2007, 4:32:15 PM (12 years ago)
Author:
Nick Burch
Message:

Add flag checking for automated runs

File:
1 edited

Legend:

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

    r575 r576  
    1313                                                turn_wgs84_into_osie36, turn_osie36_into_eastingnorthing
    1414import os
     15import sys
    1516
    1617# Database settings
     
    2021dbuser = "npemap"
    2122dbpass = ""
     23
     24
     25# What arguments did they pass in?
     26download = False
     27confirm_update = True
     28for arg in sys.argv[1:]:
     29        if arg == "--download":
     30                download = True
     31        if arg == "--no-confirm":
     32                confirm_update = False
    2233
    2334
     
    6879
    6980# Download the latest list of postcodes if needed
    70 download = False
    7181current_file = None
    7282if os.path.isfile("currentlist"):
     
    7585        current_file = "/tmp/currentlist"
    7686
    77 if not current_file == None:
     87if not download and not current_file == None:
    7888        print "Data found, do you wish to re-download?"
    7989        redownload = raw_input("")
     
    154164
    155165# Only prompt if it's a big difference
    156 if count == 0 or len(postcodes) == 0 or len(postcodes) < count or (len(postcodes)-count) > 50:
     166if confirm_update and \
     167        (count == 0 or len(postcodes) == 0 or
     168        len(postcodes) < count or (len(postcodes)-count) > 50):
    157169        print "Are you sure you wish to run an import?"
    158170        confirm = raw_input("")
Note: See TracChangeset for help on using the changeset viewer.