Changeset 9559


Ignore:
Timestamp:
Aug 25, 2011, 12:08:25 PM (13 years ago)
Author:
rick
Message:

Code cleanup

File:
1 edited

Legend:

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

    r9558 r9559  
    9494      ssid, encryption = ap_pool[bssid]
    9595      # Special trick in SSID ts avoid escaping in later stage
    96       value_str = str((bssid,ssid.replace('%','%%'),encryption))
    97       sql_values.append(value_str)
     96      item = str((bssid,ssid.replace('%','%%'),encryption))
     97      sql_values.append(item)
    9898    counters['ap_added'] = bulk_sql('gheat_accespoint (`mac`, `ssid`, `encryptie`)',sql_values)
    9999
     
    105105  sql_values = []
    106106  for (bssid,lat,lon),signal in meting_pool.iteritems():
    107     value_str = str((int(meetrondje.id),mac2id[bssid],float(lat),float(lon),int(signaal)))
    108     sql_values.append(value_str)
     107    item = str((int(meetrondje.id),mac2id[bssid],float(lat),float(lon),int(signaal)))
     108    sql_values.append(item)
    109109
    110110  # Bulk Import data if possible
     
    123123    make_option('-d', '--datum', dest='datum', default=None, help="Provide date  \
    124124      in following format: %Y-%m-%d-%H%M%S, by default it will be generated from \
    125       the filename"),)
     125      the filename"),
     126  )
    126127
    127128  def handle(self, *args, **options):
     
    134135      if not os.path.isfile(csv_file):
    135136        raise CommandError("csv file '%s' does not exists" % csv_file)
    136       self.stdout.write("#INFO: Processing '%s'\n" % csv_file)
     137      logger.info("Processing '%s'" % csv_file)
    137138
    138139      # Meetrondje from filename if needed
     
    151152        raise CommandError("Invalid date '%s'" % options['datum'])
    152153
    153       logger.info("Going to import '%s'" % (os.path.basename(csv_file)))
    154154      # Create meetrondje object
    155155      g, created = Gebruiker.objects.get_or_create(naam=options['gebruiker'] , email=options['email'])
     
    161161        sys.exit(1)
    162162      counters = import_droidstumbler(csv_file,mr)
    163       logger.info("Summary accespoints: added:%(ap_added)-6s processed:%(ap_total)-6s" % counters)
    164       logger.info("Summary metingen   : added:%(meting_added)-6s processed:%(meting_total)-6s" % counters)
     163      logger.info("summary accespoints: added:%(ap_added)-6s processed:%(ap_total)-6s" % counters)
     164      logger.info("summary metingen   : added:%(meting_added)-6s processed:%(meting_total)-6s" % counters)
Note: See TracChangeset for help on using the changeset viewer.