Пример #1
0
 def reparse_members_from_votes_page(self, page=None):
     from simple.management.commands.syncdata import Command as SyncdataCommand
     page = self.redownload_votes_page() if page is None else page
     syncdata = SyncdataCommand()
     results = syncdata.read_member_votes(page, return_ids=True)
     for (voter_id, voter_party, vote) in results:
         try:
             m = Member.objects.get(pk=int(voter_id))
         except:
             exceptionType, exceptionValue, exceptionTraceback = sys.exc_info(
             )
             logger.error(
                 "%svoter_id = %s", ''.join(
                     traceback.format_exception(exceptionType,
                                                exceptionValue,
                                                exceptionTraceback)),
                 str(voter_id))
             continue
         va, created = VoteAction.objects.get_or_create(vote=self,
                                                        member=m,
                                                        defaults={
                                                            'type':
                                                            vote,
                                                            'party':
                                                            m.current_party
                                                        })
         if created:
             va.save()
Пример #2
0
 def reparse_members_from_votes_page(self, page=None):
     from simple.management.commands.syncdata import Command as SyncdataCommand
     page = self.redownload_votes_page() if page is None else page
     syncdata = SyncdataCommand()
     results = syncdata.read_member_votes(page, return_ids=True)
     for (voter_id, voter_party, vote) in results:
         try:
             m = Member.objects.get(pk=int(voter_id))
         except:
             exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
             logger.error("%svoter_id = %s", ''.join(traceback.format_exception(exceptionType, exceptionValue, exceptionTraceback)), str(voter_id))
             continue
         va,created = VoteAction.objects.get_or_create(vote = self, member = m, defaults={'type':vote, 'party':m.current_party})
         if created:
             va.save()
Пример #3
0
    def reparse_members_from_votes_page(self, page=None):
        from simple.management.commands.syncdata import Command as SyncdataCommand
        page = self.redownload_votes_page() if page is None else page
        syncdata = SyncdataCommand()
        results = syncdata.read_member_votes(page, return_ids=True)
        for (voter_id, voter_party, vote) in results:
            try:
                member = Member.objects.get(pk=int(voter_id))
            except Exception:

                logger.exception("reparse vote member exception for vote %s member %s" % (self.pk, member.pk))
                continue

            va, created = VoteAction.objects.get_or_create(vote=self, member=member,
                                                           defaults={'type': vote, 'party': member.current_party})
            if created:
                va.save()
Пример #4
0
    def reparse_members_from_votes_page(self, page=None):
        from simple.management.commands.syncdata import Command as SyncdataCommand
        page = self.redownload_votes_page() if page is None else page
        syncdata = SyncdataCommand()
        results = syncdata.read_member_votes(page, return_ids=True)
        for (voter_id, voter_party, vote) in results:
            try:
                member = Member.objects.get(pk=int(voter_id))
            except Exception:

                logger.exception(
                    "reparse vote member exception for vote %s member %s" %
                    (self.pk, member.pk))
                continue

            va, created = VoteAction.objects.get_or_create(
                vote=self,
                member=member,
                defaults={
                    'type': vote,
                    'party': member.current_party
                })
            if created:
                va.save()