py3: remove u'' notation (#46576)

This commit is contained in:
Thomas NOËL 2020-09-11 12:04:21 +02:00
parent f5896c55d4
commit 29da935811
1 changed files with 22 additions and 22 deletions

View File

@ -117,10 +117,10 @@ class ResourceView(DetailView):
self.translations = json_loads(translations_txt)
# logger.debug('Translation JSON: %r', translations)
document = u'<html>'
document += u'<head><meta charset="utf-8"></head>'
document = '<html>'
document += '<head><meta charset="utf-8"></head>'
document += '<body>'
document += u'<h1>%s</h1>' % self.translate('form_title', schema['name'])
document += '<h1>%s</h1>' % self.translate('form_title', schema['name'])
page = ''
empty_page = True
for field in schema['fields']:
@ -128,12 +128,12 @@ class ResourceView(DetailView):
# add last page, if it contains values
if page and not empty_page:
document += page
page = u'<hr /><h2>%s</h2>' % self.translate(field['label'], field['label'])
page = '<hr /><h2>%s</h2>' % self.translate(field['label'], field['label'])
empty_page = True
elif field['type'] == 'title':
page += u'<h3>%s</h3>' % field['label']
page += '<h3>%s</h3>' % field['label']
# elif field['type'] == 'subtitle':
# page += u'<h3>%s</h3>' % self.translate(field['label'], field['label'])
# page += '<h3>%s</h3>' % self.translate(field['label'], field['label'])
elif 'varname' in field:
varname = field['varname']
value = formdata['fields'].get(varname)
@ -157,14 +157,14 @@ class ResourceView(DetailView):
elif field['type'] == 'item' and self.translations:
value_raw = formdata['fields'].get(varname + '_raw')
value = self.translate(varname + '_' + value_raw, value)
page += u'<dl>'
page += u'<dt>%s</dt>' % self.translate(varname, field['label'])
page += u'<dd>%s</dd>' % value
page += u'</dl>'
page += '<dl>'
page += '<dt>%s</dt>' % self.translate(varname, field['label'])
page += '<dd>%s</dd>' % value
page += '</dl>'
empty_page = False
if page and not empty_page: # add last page, if it contains values
document += page
document += u'</body></html>'
document += '</body></html>'
encodedFile = document.encode('utf-8').encode('base64')
fileFormat = 'html'
@ -517,10 +517,10 @@ class DebugView(DetailView):
else:
logger.debug('AUCUNE Translation JSON: %r', self.translations)
document = u'<html>'
document += u'<head><meta charset="utf-8"></head>'
document = '<html>'
document += '<head><meta charset="utf-8"></head>'
document += '<body>'
document += u'<h1>%s</h1>' % self.translate('form_title', schema['name'])
document += '<h1>%s</h1>' % self.translate('form_title', schema['name'])
page = ''
empty_page = True
for field in schema['fields']:
@ -529,12 +529,12 @@ class DebugView(DetailView):
# add last page, if it contains values
if page and not empty_page:
document += page
page = u'<hr /><h2>%s</h2>' % self.translate(field['label'], field['label'])
page = '<hr /><h2>%s</h2>' % self.translate(field['label'], field['label'])
empty_page = True
# elif field['type'] == 'title':
# page += u'<h3>%s</h3>' % self.translate(field['label'], field['label'])
# page += '<h3>%s</h3>' % self.translate(field['label'], field['label'])
elif field['type'] == 'subtitle':
page += u'<h3>%s</h3>' % self.translate(field['label'], field['label'])
page += '<h3>%s</h3>' % self.translate(field['label'], field['label'])
elif 'varname' in field:
varname = field['varname']
value = formdata['fields'].get(varname)
@ -560,14 +560,14 @@ class DebugView(DetailView):
elif field['type'] == 'item' and self.translations:
value_raw = formdata['fields'].get(varname + '_raw')
value = self.translate(varname + '_' + value_raw, value)
page += u'<dl>'
page += u'<dt>%s</dt>' % self.translate(varname, field['label'])
page += u'<dd>%s</dd>' % value
page += u'</dl>'
page += '<dl>'
page += '<dt>%s</dt>' % self.translate(varname, field['label'])
page += '<dd>%s</dd>' % value
page += '</dl>'
empty_page = False
if page and not empty_page: # add last page, if it contains values
document += page
document += u'</body></html>'
document += '</body></html>'
logger.debug('DOCUMENT HTML %r ', document)
encodedFile = document.encode('utf-8').encode('base64')
fileFormat = 'html'