Changeset 9626
- Timestamp:
- Aug 30, 2011, 6:24:00 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/gheat/management/commands/import_datafile.py
r9625 r9626 37 37 38 38 # Prefix/Suffix removal 39 valid_prefix = ['DroidStumbler-', 'Kismet-']39 valid_prefixes = ['DroidStumbler-', 'Kismet-','ScanResult-'] 40 40 def strip_prefix(filename): 41 for suffix in valid_suffixes: 42 filename = filename.rstrip(suffix) 41 for prefix in valid_prefixes: 42 if filename.startswith(prefix): 43 filename = filename[len(prefix):] 43 44 return filename 44 45 valid_suffixes = ['.gz', '.gpsxml', '.netxml', '.csv', '.ns1'] 45 46 def strip_suffix(filename): 46 47 for suffix in valid_suffixes: 47 filename = filename.rstrip(suffix) 48 if filename.endswith(suffix): 49 filename = filename[:-len(suffix)] 48 50 return filename 49 51 def strip_file(filename): … … 170 172 return datetime.datetime.strptime(datestr,'%Y%m%d-%H-%M-%S-1') 171 173 except ValueError: 172 raise CommandError("Invalid date '%s'" % options['datum'])174 raise CommandError("Invalid date '%s'" % datestr) 173 175 if options['datum'] == None: 174 176 datestr = strip_file(os.path.basename(filename))
Note:
See TracChangeset
for help on using the changeset viewer.