Example #1
0
 def handle(self, *args, **options):
     try:
         if args[0] == 'ap':
             pass
         elif args[0] == 'county':
             pass
         elif args[0] == 'state':
             pass
         elif args[0] == 'combined':
             from open_elections.content_parser import emit_combined_csv_results
             emit_combined_csv_results()
         self.stdout.write('Successfully ran function "emit_%s_csv_results()"' % args[0])
     except ImportError:
         raise CommandError('Function "emit_%s_csv_results()" does not exist' % args[0])
Example #2
0
    def handle(self, *args, **options):

        content = ContentFetcher()
        try:
            if args[0] == 'state':
                from open_elections.content_parser import parse_state_xml
                state_xml_files = content.fetch_sos()
                parse_state_xml(state_xml_files)
                emit_combined_csv_results()
                
            elif args[0] == 'county':
                from open_elections.content_parser import parse_county_xml
                county_xml_file = content.fetch_xml_content(server="county")
                parse_county_xml(county_xml_file)
                emit_combined_csv_results()
                
            elif args[0] == 'ap':
                from open_elections.content_parser import parse_ap_xml
                ap_xml_file = content.fetch_xml_content(server="ap")
                parse_county_xml(ap_xml_file)
                emit_combined_csv_results()

            self.stdout.write('Successfully ran function "parse_%s_xml()"' % args[0])
        except ImportError:
            raise CommandError('Function "parse_%s_xml()" does not exist' % args[0])