Ignore:
Timestamp:
Aug 23, 2011, 8:33:34 PM (13 years ago)
Author:
rick
Message:

Do not nag if one point (out of thousends) is invalid.

File:
1 edited

Legend:

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

    r9176 r9548  
    55
    66from django.core.management.base import BaseCommand,CommandError
     7from django.db.utils import IntegrityError
    78from optparse import OptionParser, make_option
    89from gheat.models import *
     
    7677    # TODO: This also saves semi-duplicates; multiple entries with the same values, except
    7778    # the signal strength is different. Should get an AVG or something.
    78     meting= Meting.objects.create(meetrondje=mr, accespoint=ap_cache[bssid],
    79       latitude=point.attrib['lat'], longitude=point.attrib['lon'],
    80       signaal=signaal)
     79    try:
     80      meting= Meting.objects.create(meetrondje=mr, accespoint=ap_cache[bssid],
     81        latitude=point.attrib['lat'], longitude=point.attrib['lon'],
     82        signaal=signaal)
     83    except IntegrityError, e:
     84      continue
    8185    # Give some feedback to the user
    8286    count += 1
Note: See TracChangeset for help on using the changeset viewer.