Ignore:
Timestamp:
May 12, 2011, 8:35:35 AM (14 years ago)
Author:
rick
Message:

Whoops forgot about 0 entries to import.

File:
1 edited

Legend:

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

    r9182 r9183  
    9191  # Make sure to include closing newline
    9292  if show_progres: output.write("%s\n" % meting_count)
     93
     94  # Bulk Import data if possible
    9395  if bulk_import:
    94     sql = "INSERT INTO gheat_meting (`meetrondje_id`, `accespoint_id`, `lat`, `lng`, `signaal`) VALUES %s" % ','.join(sql_values)
    95     cursor.execute(sql)
    96     transaction.commit_unless_managed()
     96    if len(sql_values) == 0:
     97      logging.warn("No data to import")
     98    else:
     99      try:
     100        sql = "INSERT INTO gheat_meting (`meetrondje_id`, `accespoint_id`, `lat`, `lng`, `signaal`) VALUES %s" % ','.join(sql_values)
     101        cursor.execute(sql)
     102        transaction.commit_unless_managed()
     103      except IntegrityError, e:
     104        logging.error("Unable to import - %s" %  e)
     105        pass
    97106
    98107  return (len(ap_cache), new_ap_count, meting_count, len(meting_pool) - meting_count)
Note: See TracChangeset for help on using the changeset viewer.