Ejemplo n.º 1
0
 def writeHeaders(self):
     if self.report.ftype == REPORT.CSV:
         string = tools.normalize_to_ascii('"'+'","'.join(self.headers)+'"\n')
         self.gcs_file.write(string)
         if self.has_section_files():
             for section_gcs_file, section_headers in zip(self.section_gcs_files, self.section_headers):
                 string = tools.normalize_to_ascii('"'+'","'.join(section_headers)+'"\n')
                 section_gcs_file.write(string)
     elif self.report.ftype == REPORT.XLS:
         for i, header in enumerate(self.headers):
             self.ws.write(0, i, header, self.xls_styles['bold'])
         if self.has_section_files():
             for i, header in enumerate(self.section_headers):
                 self.section_ws.write(0, i, header, self.xls_styles['bold'])
Ejemplo n.º 2
0
 def writeHeaders(self):
     if self.report.ftype == REPORT.CSV:
         string = tools.normalize_to_ascii('"'+'","'.join(self.headers)+'"\n')
         self.gcs_file.write(string)
     elif self.report.ftype == REPORT.XLS:
         for i, header in enumerate(self.headers):
             self.ws.write(0, i, header, self.xls_styles['bold'])
Ejemplo n.º 3
0
    def testTextSanitization(self):
        # Remove non-ascii
        from decimal import Decimal
        volley = [
            ('‘Hello’', 'Hello'), (int(10), '10'), (False, 'False'),
            (long(20), '20'), (u'‘Hello’', 'Hello'),
            (u'‘Hello\nHi’', 'Hello\nHi'),
            (u'Kl\xfcft skr\xe4ms inf\xf6r p\xe5 f\xe9d\xe9ral \xe9lectoral gro\xdfe',
             'Kluft skrams infor pa federal electoral groe'),
            (db.Text(u'‘Hello’'), 'Hello'),
            (db.Text(u'naïve café'), 'naive cafe')
        ]

        for v in volley:
            target = v[1]
            actual = tools.normalize_to_ascii(v[0])
            self.assertEqual(actual, target)
Ejemplo n.º 4
0
    def testTextSanitization(self):
        # Remove non-ascii
        from decimal import Decimal
        volley = [
            ('‘Hello’', 'Hello'),
            (int(10), '10'),
            (False, 'False'),
            (long(20), '20'),
            (u'‘Hello’', 'Hello'),
            (u'‘Hello\nHi’', 'Hello\nHi'),
            (u'Kl\xfcft skr\xe4ms inf\xf6r p\xe5 f\xe9d\xe9ral \xe9lectoral gro\xdfe',
               'Kluft skrams infor pa federal electoral groe'),
            (db.Text(u'‘Hello’'), 'Hello'),
            (db.Text(u'naïve café'), 'naive cafe')
        ]

        for v in volley:
            target = v[1]
            actual = tools.normalize_to_ascii(v[0])
            self.assertEqual(actual, target)
Ejemplo n.º 5
0
 def writeHeaders(self):
     if self.report.ftype == REPORT.CSV:
         string = tools.normalize_to_ascii('"' + '","'.join(self.headers) +
                                           '"\n')
         self.gcs_file.write(string)