コード例 #1
0
 def generate_csv_file(self, lang):
     csvfile = file(self.get_poll_result_file_path('csv', 'csv', lang[0]), "w")
     if self.module_id == "score":
         csv_from_score_polls(self.election, [self.poll], lang[0], csvfile)
     elif self.module_id == "stv":
         csv_from_stv_polls(self.election, [self.poll], lang[0], csvfile)
     else:
         csv_from_polls(self.election, [self.poll], lang[0], csvfile)
     csvfile.close()
コード例 #2
0
ファイル: __init__.py プロジェクト: grnet/zeus
 def generate_csv_file(self, lang):
     csvfile = file(self.get_poll_result_file_path("csv", "csv", lang[0]), "w")
     if self.module_id == "score":
         csv_from_score_polls(self.election, [self.poll], lang[0], csvfile)
     elif self.module_id == "stv":
         csv_from_stv_polls(self.election, [self.poll], lang[0], csvfile)
     else:
         csv_from_polls(self.election, [self.poll], lang[0], csvfile)
     csvfile.close()
コード例 #3
0
ファイル: __init__.py プロジェクト: Hazardius/zeus
 def generate_csv_file(self, lang):
     with open(self.get_poll_result_file_path('csv', 'csv', lang[0]),
               "w") as f:
         if self.module_id == "score":
             csv_from_score_polls(self.election, [self.poll], lang[0], f)
         elif self.module_id == "stv":
             csv_from_stv_polls(self.election, [self.poll], lang[0], f)
         else:
             csv_from_polls(self.election, [self.poll], lang[0], f)
コード例 #4
0
 def generate_election_csv_file(self, lang):
     csvpath = self.get_election_result_file_path('csv', 'csv', lang[0])
     csvfile = file(self.get_election_result_file_path('csv', 'csv', lang[0]), "w")
     if self.module_id == "score":
         csv_from_score_polls(self.election, self.election.polls.all(),\
             lang[0], csvfile)
     elif self.module_id == "stv":
         csv_from_stv_polls(self.election, self.election.polls.all(),\
                            lang[0], csvfile)
     else:
         csv_from_polls(self.election, self.election.polls.all(),\
                        lang[0], csvfile)
     csvfile.close()
コード例 #5
0
ファイル: __init__.py プロジェクト: gchatzip/zeus
 def generate_election_csv_file(self, lang):
     csvpath = self.get_election_result_file_path('csv', 'csv', lang[0])
     csvfile = file(self.get_election_result_file_path('csv', 'csv', lang[0]), "w")
     if self.module_id == "score":
         csv_from_score_polls(self.election, self.election.polls.all(),\
             lang[0], csvfile)
     elif self.module_id == "stv":
         csv_from_stv_polls(self.election, self.election.polls.all(),\
                            lang[0], csvfile)
     else:
         csv_from_polls(self.election, self.election.polls.all(),\
                        lang[0], csvfile)
     csvfile.close()
コード例 #6
0
ファイル: test_security.py プロジェクト: grnet/zeus
    def test_csv_writer(self):
        from zeus.reports import csv_from_polls
        from StringIO import StringIO
        buffer = StringIO()

        for char in ["=", "+", "-", "@"]:
            election, polls = self.make_election({
                'name': '%sINJECTION()' % char
            })

            csv_from_polls(election, polls, "el", buffer)
            # injection escaped with '
            self.assertTrue(",'%sINJECTION" % char in buffer.getvalue())