Ignore:
Timestamp:
May 6, 2011, 4:04:18 PM (14 years ago)
Author:
dennisw
Message:

Value check for csv import.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/gheat/management/commands/import_csv.py

    r9142 r9157  
    66#
    77# In theory, only the -f option is needed, but for overview's sake, please use the others aswell.
    8 # -f = location of the .netxml, e.g. '/home/test.csv'
     8# -f = location of the .csv, e.g. '/home/test.csv'
    99# -m = name of the dataset, e.g. 'Walk in park' or 'Trip with boat'
    1010# -g = your name
    1111# -e = your email address
     12# -a = antenna
     13# -k = network card
    1214#
    1315# (Run from project root)
    14 # ./manage.py import_csv -f <file location> -m <dataset name> -g <username> -e <email>
     16# ./manage.py import_csv -f <file location> -m <dataset name> -g <username> -e <email> - a <antenna> -k <network card>
    1517#
    1618# Make sure the variables in this script match the column numbers in your file e.g.;
     
    5961    print lat, lon, ssid, bssid, enc, sig
    6062
     63    # Simple check for bad values
     64    if lat.startswith('0.'):
     65      print 'Bad lat'
     66      continue
     67    elif lon.startswith('0.'):
     68      print 'Bad lon'
     69      continue
     70    elif sig not in range(1,101):
     71      print 'Bad sig'
     72      continue
     73    else:
     74      print 'No bad values'
     75
    6176    # Creating accespoint objects. Avoiding duplicates.
    6277    ap, created = Accespoint.objects.get_or_create(mac=bssid, ssid=ssid, encryptie=enc)
Note: See TracChangeset for help on using the changeset viewer.