def handle(self, *args, **options):
		f = open('/tmp/contacts.adif')
		d = f.read()
		p = ADIFParser(d)
		r = p.next_record()
		while r.call:
			if r.mode == 'JT65':
				qso_date = datetime.datetime.strptime(r.qso_date,'%Y%m%d')
				contact, created = Contact.objects.get_or_create(
					when = qso_date,
					callsign=r.call,
					band=r.band
				)
				if created: print 'Added',contact
				
			r = p.next_record()
	def test_record_parse(self):
		p = ADIFParser('<call:4>W2PE <class:2>2A<eor>')
		r = p.next_record()
		self.assertEquals('W2PE',r.call)
		self.assertEquals('2A',r.class_r)
        def test_no_records(self):
		p = ADIFParser('Here\'s a file\n with some text but no actual record!')
		self.assertFalse(p.next_record())
	def test_empty(self):
		p = ADIFParser('')
		self.assertFalse(p.next_record())
	def test_none(self):
		p = ADIFParser(None)
		self.assertFalse(p.next_record())