Changeset 620 for trunk


Ignore:
Timestamp:
Dec 17, 2007, 12:20:05 PM (12 years ago)
Author:
Nick Burch
Message:

More paranoia, even with --no-confirm

File:
1 edited

Legend:

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

    r577 r620  
    167167
    168168# Only prompt if it's a big difference
    169 if confirm_update and \
    170         (count == 0 or len(postcodes) == 0 or
    171         len(postcodes) < count or (len(postcodes)-count) > 50):
    172         print "Are you sure you wish to run an import?"
    173         confirm = raw_input("")
    174         print ""
    175 
    176         if confirm == "y" or confirm == "yes":
    177                 # Good, go ahead
    178                 pass
    179         else:
     169if confirm_update:
     170        if (count == 0 or len(postcodes) == 0 or
     171                        len(postcodes) < count or (len(postcodes)-count) > 50):
     172                print "Are you sure you wish to run an import?"
     173                confirm = raw_input("")
    180174                print ""
    181                 raise Exception("Aborting import")
     175
     176                if confirm == "y" or confirm == "yes":
     177                        # Good, go ahead
     178                        pass
     179                else:
     180                        print ""
     181                        raise Exception("Aborting import")
     182else:
     183        # Don't trash everything even with --no-confirm
     184        if len(postcodes) == 0 or (len(postcodes)-count) > 100:
     185                raise Exception("Postcode count too different, not running (re-run without --no-confirm to allow")
    182186
    183187
Note: See TracChangeset for help on using the changeset viewer.