Projet

Général

Profil

0002-py3-remove-u-notation-46576.patch

Thomas Noël, 11 septembre 2020 12:10

Télécharger (5,63 ko)

Voir les différences:

Subject: [PATCH 2/3] py3: remove u'' notation (#46576)

 passerelle_minint/minint_maarch/views.py | 44 ++++++++++++------------
 1 file changed, 22 insertions(+), 22 deletions(-)
passerelle_minint/minint_maarch/views.py
117 117
            self.translations = json_loads(translations_txt)
118 118
            # logger.debug('Translation JSON: %r', translations)
119 119

  
120
        document = u'<html>'
121
        document += u'<head><meta charset="utf-8"></head>'
120
        document = '<html>'
121
        document += '<head><meta charset="utf-8"></head>'
122 122
        document += '<body>'
123
        document += u'<h1>%s</h1>' % self.translate('form_title', schema['name'])
123
        document += '<h1>%s</h1>' % self.translate('form_title', schema['name'])
124 124
        page = ''
125 125
        empty_page = True
126 126
        for field in schema['fields']:
......
128 128
                # add last page, if it contains values
129 129
                if page and not empty_page:
130 130
                    document += page
131
                page = u'<hr /><h2>%s</h2>' % self.translate(field['label'], field['label'])
131
                page = '<hr /><h2>%s</h2>' % self.translate(field['label'], field['label'])
132 132
                empty_page = True
133 133
            elif field['type'] == 'title':
134
                page += u'<h3>%s</h3>' % field['label']
134
                page += '<h3>%s</h3>' % field['label']
135 135
            # elif field['type'] == 'subtitle':
136
            #     page += u'<h3>%s</h3>' % self.translate(field['label'], field['label'])
136
            #     page += '<h3>%s</h3>' % self.translate(field['label'], field['label'])
137 137
            elif 'varname' in field:
138 138
                varname = field['varname']
139 139
                value = formdata['fields'].get(varname)
......
157 157
                elif field['type'] == 'item' and self.translations:
158 158
                    value_raw = formdata['fields'].get(varname + '_raw')
159 159
                    value = self.translate(varname + '_' + value_raw, value)
160
                page += u'<dl>'
161
                page += u'<dt>%s</dt>' % self.translate(varname, field['label'])
162
                page += u'<dd>%s</dd>' % value
163
                page += u'</dl>'
160
                page += '<dl>'
161
                page += '<dt>%s</dt>' % self.translate(varname, field['label'])
162
                page += '<dd>%s</dd>' % value
163
                page += '</dl>'
164 164
                empty_page = False
165 165
        if page and not empty_page: # add last page, if it contains values
166 166
            document += page
167
        document += u'</body></html>'
167
        document += '</body></html>'
168 168
        encodedFile = document.encode('utf-8').encode('base64')
169 169
        fileFormat = 'html'
170 170

  
......
517 517
        else:
518 518
            logger.debug('AUCUNE Translation JSON: %r', self.translations)
519 519

  
520
        document = u'<html>'
521
        document += u'<head><meta charset="utf-8"></head>'
520
        document = '<html>'
521
        document += '<head><meta charset="utf-8"></head>'
522 522
        document += '<body>'
523
        document += u'<h1>%s</h1>' % self.translate('form_title', schema['name'])
523
        document += '<h1>%s</h1>' % self.translate('form_title', schema['name'])
524 524
        page = ''
525 525
        empty_page = True
526 526
        for field in schema['fields']:
......
529 529
                # add last page, if it contains values
530 530
                if page and not empty_page:
531 531
                    document += page
532
                page = u'<hr /><h2>%s</h2>' % self.translate(field['label'], field['label'])
532
                page = '<hr /><h2>%s</h2>' % self.translate(field['label'], field['label'])
533 533
                empty_page = True
534 534
            # elif field['type'] == 'title':
535
            #     page += u'<h3>%s</h3>' % self.translate(field['label'], field['label'])
535
            #     page += '<h3>%s</h3>' % self.translate(field['label'], field['label'])
536 536
            elif field['type'] == 'subtitle':
537
                page += u'<h3>%s</h3>' % self.translate(field['label'], field['label'])
537
                page += '<h3>%s</h3>' % self.translate(field['label'], field['label'])
538 538
            elif 'varname' in field:
539 539
                varname = field['varname']
540 540
                value = formdata['fields'].get(varname)
......
560 560
                elif field['type'] == 'item' and self.translations:
561 561
                    value_raw = formdata['fields'].get(varname + '_raw')
562 562
                    value = self.translate(varname + '_' + value_raw, value)
563
                page += u'<dl>'
564
                page += u'<dt>%s</dt>' % self.translate(varname, field['label'])
565
                page += u'<dd>%s</dd>' % value
566
                page += u'</dl>'
563
                page += '<dl>'
564
                page += '<dt>%s</dt>' % self.translate(varname, field['label'])
565
                page += '<dd>%s</dd>' % value
566
                page += '</dl>'
567 567
                empty_page = False
568 568
        if page and not empty_page:  # add last page, if it contains values
569 569
            document += page
570
        document += u'</body></html>'
570
        document += '</body></html>'
571 571
        logger.debug('DOCUMENT HTML %r ', document)
572 572
        encodedFile = document.encode('utf-8').encode('base64')
573 573
        fileFormat = 'html'
574
-